58 template <
class C1,
class C2,
class C3,
class C4>
62 const C3& refProdMany,
66 template <
class C1,
class C2,
class C3,
class C4>
70 const C3& refProdMany,
74 template <
class C1,
class C2,
class C3,
class C4>
78 const C3& refProdMany,
82 template <
class C1,
class C2,
class C3>
85 template <
class C1,
class C2,
class C3>
119 produces<std::vector<pat::Jet>>(
"jets");
120 produces<std::vector<pat::Muon>>(
"muons");
121 produces<std::vector<pat::Electron>>(
"electrons");
122 produces<std::vector<pat::Photon>>(
"photons");
123 produces<std::vector<pat::Tau>>(
"taus");
126 produces<std::vector<pat::Electron>>(
"lowPtElectrons");
130 produces<std::vector<pat::Tau>>(
"boostedTaus");
134 produces<std::vector<reco::VertexCompositePtrCandidate>>(
"vertices");
150 template <
class C1,
class C2,
class C3,
class C4>
154 const C3& refProdMany,
158 for (
auto&
j : itemsOne) {
161 for (
auto&
m : itemsMany) {
163 m.addUserCand(nameOne,
reco::CandidatePtr(refProdOne.id(), ji, refProdOne.productGetter()));
174 template <
class C1,
class C2,
class C3,
class C4>
178 const C3& refProdMany,
182 for (
auto&
j : itemsOne) {
185 for (
auto&
m : itemsMany) {
187 m.addUserCand(nameOne,
reco::CandidatePtr(refProdOne.id(), ji, refProdOne.productGetter()));
198 template <
class C1,
class C2,
class C3,
class C4>
202 const C3& refProdMany,
206 for (
auto&
j : itemsOne) {
207 std::vector<std::pair<size_t, float>> idxs;
209 for (
auto&
m : itemsMany) {
212 m.addUserCand(nameOne,
reco::CandidatePtr(refProdOne.id(), ji, refProdOne.productGetter()));
213 idxs.push_back(std::make_pair(mi, dr2));
217 std::sort(idxs.begin(), idxs.end(), [](
auto& left,
auto& right) {
return left.second < right.second; });
220 for (
auto idx : idxs) {
230 template <
class C1,
class C2,
class C3>
232 const C2& refProdVtx,
235 for (
auto&
j : itemsOne) {
238 for (
auto&
v : itemsVtx) {
250 template <
class C1,
class C2,
class C3>
256 for (
auto&
v : itemsVtx) {
257 for (
auto&
m : itemsMany) {
259 m.addUserCand(nameVtx,
reco::CandidatePtr(refProdVtx.id(), vi, refProdVtx.productGetter()));
269 auto jets = std::make_unique<std::vector<pat::Jet>>();
270 jets->reserve(jetsIn.size());
271 for (
const auto&
j : jetsIn)
273 auto jetRefProd =
iEvent.getRefBeforePut<std::vector<pat::Jet>>(
"jets");
276 auto muons = std::make_unique<std::vector<pat::Muon>>();
277 muons->reserve(muonsIn.size());
278 for (
const auto&
m : muonsIn)
280 auto muRefProd =
iEvent.getRefBeforePut<std::vector<pat::Muon>>(
"muons");
283 auto electrons = std::make_unique<std::vector<pat::Electron>>();
285 for (
const auto&
e : electronsIn)
287 auto eleRefProd =
iEvent.getRefBeforePut<std::vector<pat::Electron>>(
"electrons");
290 auto taus = std::make_unique<std::vector<pat::Tau>>();
291 taus->reserve(tausIn.size());
292 for (
const auto&
t : tausIn)
294 auto tauRefProd =
iEvent.getRefBeforePut<std::vector<pat::Tau>>(
"taus");
297 auto photons = std::make_unique<std::vector<pat::Photon>>();
298 photons->reserve(photonsIn.size());
299 for (
const auto&
p : photonsIn)
301 auto phRefProd =
iEvent.getRefBeforePut<std::vector<pat::Photon>>(
"photons");
303 auto lowPtElectrons = std::make_unique<std::vector<pat::Electron>>();
307 for (
const auto&
e : lowPtElectronsIn) {
312 auto boostedTaus = std::make_unique<std::vector<pat::Tau>>();
316 for (
const auto&
e : boostedTausIn) {
321 auto vertices = std::make_unique<std::vector<reco::VertexCompositePtrCandidate>>();
324 vertices->reserve(verticesIn.size());
325 for (
const auto&
e : verticesIn) {
341 auto lowPtEleRefProd =
iEvent.getRefBeforePut<std::vector<pat::Electron>>(
"lowPtElectrons");
347 auto boostedTauRefProd =
iEvent.getRefBeforePut<std::vector<pat::Tau>>(
"boostedTaus");
352 auto vtxRefProd =
iEvent.getRefBeforePut<std::vector<reco::VertexCompositePtrCandidate>>(
"vertices");
381 desc.add<
edm::InputTag>(
"jets")->setComment(
"a jet collection derived from pat::Jet");
382 desc.add<
edm::InputTag>(
"muons")->setComment(
"a muon collection derived from pat::Muon");
383 desc.add<
edm::InputTag>(
"electrons")->setComment(
"an electron collection derived from pat::Electron");
384 desc.add<
edm::InputTag>(
"photons")->setComment(
"a photon collection derived from pat::Photon");
385 desc.add<
edm::InputTag>(
"taus")->setComment(
"a tau collection derived from pat::Tau");
387 ->setComment(
"an optional electron collection derived from pat::Electron, empty=>not used");
389 ->setComment(
"an optional boosted tau collection derived from pat::Tau, empty=>not used");
391 ->setComment(
"an optional vertex collection derived from reco::VertexCompositePtrCandidate,empty=>not used");
392 descriptions.
add(
"patObjectCrossLinker",
desc);
~PATObjectCrossLinker() override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void matchOneToMany(const C1 &refProdOne, C2 &itemsOne, const std::string &nameOne, const C3 &refProdMany, C4 &itemsMany, const std::string &nameMany)
EDProductGetter const * productGetter() const
Accessor for product getter.
void produce(edm::Event &, const edm::EventSetup &) override
void beginStream(edm::StreamID) override
void matchOneToVertices(C1 &itemsOne, const C2 &refProdVtx, C3 &itemsVtx, const std::string &nameVtx)
const edm::EDGetTokenT< edm::View< pat::Muon > > muons_
bool matchByCommonParentSuperClusterRef(const C1 &c1, const C2 &c2)
edm::EDGetTokenT< edm::View< pat::Electron > > lowPtElectrons_
void matchVertexToMany(const C1 &refProdVtx, C2 &itemsVtx, const std::string &nameVtx, C3 &itemsMany)
PATObjectCrossLinker(const edm::ParameterSet &)
edm::EDGetTokenT< edm::View< pat::Tau > > boostedTaus_
bool matchByCommonSourceCandidatePtr(const C1 &c1, const C2 &c2)
const edm::EDGetTokenT< edm::View< pat::Jet > > jets_
#define DEFINE_FWK_MODULE(type)
const edm::EDGetTokenT< edm::View< pat::Electron > > electrons_
void matchElectronToPhoton(const C1 &refProdOne, C2 &itemsOne, const std::string &nameOne, const C3 &refProdMany, C4 &itemsMany, const std::string &nameMany)
void matchLowPtToElectron(const C1 &refProdOne, C2 &itemsOne, const std::string &nameOne, const C3 &refProdMany, C4 &itemsMany, const std::string &nameMany)
edm::InputTag lowPtElectronsTag_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::EDGetTokenT< edm::View< reco::VertexCompositePtrCandidate > > vertices_
const edm::EDGetTokenT< edm::View< pat::Tau > > taus_
const edm::EDGetTokenT< edm::View< pat::Photon > > photons_
void endStream() override
edm::InputTag verticesTag_
edm::InputTag boostedTausTag_