55 template <
class C1,
class C2,
class C3,
class C4>
59 const C3& refProdMany,
63 template <
class C1,
class C2,
class C3,
class C4>
67 const C3& refProdMany,
71 template <
class C1,
class C2,
class C3,
class C4>
75 const C3& refProdMany,
79 template <
class C1,
class C2,
class C3>
82 template <
class C1,
class C2,
class C3>
111 produces<std::vector<pat::Jet>>(
"jets");
112 produces<std::vector<pat::Muon>>(
"muons");
113 produces<std::vector<pat::Electron>>(
"electrons");
114 produces<std::vector<pat::Photon>>(
"photons");
115 produces<std::vector<pat::Tau>>(
"taus");
118 produces<std::vector<pat::Electron>>(
"lowPtElectrons");
122 produces<std::vector<pat::Tau>>(
"boostedTaus");
126 produces<std::vector<reco::VertexCompositePtrCandidate>>(
"vertices");
137 template <
class C1,
class C2,
class C3,
class C4>
141 const C3& refProdMany,
145 for (
auto&
j : itemsOne) {
148 for (
auto&
m : itemsMany) {
150 m.addUserCand(nameOne,
reco::CandidatePtr(refProdOne.id(), ji, refProdOne.productGetter()));
161 template <
class C1,
class C2,
class C3,
class C4>
165 const C3& refProdMany,
169 for (
auto&
j : itemsOne) {
172 for (
auto&
m : itemsMany) {
174 m.addUserCand(nameOne,
reco::CandidatePtr(refProdOne.id(), ji, refProdOne.productGetter()));
185 template <
class C1,
class C2,
class C3,
class C4>
189 const C3& refProdMany,
193 for (
auto&
j : itemsOne) {
194 std::vector<std::pair<size_t, float>> idxs;
196 for (
auto&
m : itemsMany) {
199 m.addUserCand(nameOne,
reco::CandidatePtr(refProdOne.id(), ji, refProdOne.productGetter()));
200 idxs.push_back(std::make_pair(mi, dr2));
204 std::sort(idxs.begin(), idxs.end(), [](
auto& left,
auto& right) {
return left.second < right.second; });
207 for (
auto idx : idxs) {
217 template <
class C1,
class C2,
class C3>
219 const C2& refProdVtx,
222 for (
auto&
j : itemsOne) {
225 for (
auto&
v : itemsVtx) {
237 template <
class C1,
class C2,
class C3>
243 for (
auto&
v : itemsVtx) {
244 for (
auto&
m : itemsMany) {
246 m.addUserCand(nameVtx,
reco::CandidatePtr(refProdVtx.id(), vi, refProdVtx.productGetter()));
256 auto jets = std::make_unique<std::vector<pat::Jet>>();
257 jets->reserve(jetsIn.size());
258 for (
const auto&
j : jetsIn)
260 auto jetRefProd =
iEvent.getRefBeforePut<std::vector<pat::Jet>>(
"jets");
263 auto muons = std::make_unique<std::vector<pat::Muon>>();
264 muons->reserve(muonsIn.size());
265 for (
const auto&
m : muonsIn)
267 auto muRefProd =
iEvent.getRefBeforePut<std::vector<pat::Muon>>(
"muons");
270 auto electrons = std::make_unique<std::vector<pat::Electron>>();
272 for (
const auto&
e : electronsIn)
274 auto eleRefProd =
iEvent.getRefBeforePut<std::vector<pat::Electron>>(
"electrons");
277 auto taus = std::make_unique<std::vector<pat::Tau>>();
278 taus->reserve(tausIn.size());
279 for (
const auto&
t : tausIn)
281 auto tauRefProd =
iEvent.getRefBeforePut<std::vector<pat::Tau>>(
"taus");
284 auto photons = std::make_unique<std::vector<pat::Photon>>();
285 photons->reserve(photonsIn.size());
286 for (
const auto&
p : photonsIn)
288 auto phRefProd =
iEvent.getRefBeforePut<std::vector<pat::Photon>>(
"photons");
290 auto lowPtElectrons = std::make_unique<std::vector<pat::Electron>>();
294 for (
const auto&
e : lowPtElectronsIn) {
299 auto boostedTaus = std::make_unique<std::vector<pat::Tau>>();
303 for (
const auto&
e : boostedTausIn) {
308 auto vertices = std::make_unique<std::vector<reco::VertexCompositePtrCandidate>>();
311 vertices->reserve(verticesIn.size());
312 for (
const auto&
e : verticesIn) {
328 auto lowPtEleRefProd =
iEvent.getRefBeforePut<std::vector<pat::Electron>>(
"lowPtElectrons");
334 auto boostedTauRefProd =
iEvent.getRefBeforePut<std::vector<pat::Tau>>(
"boostedTaus");
339 auto vtxRefProd =
iEvent.getRefBeforePut<std::vector<reco::VertexCompositePtrCandidate>>(
"vertices");
362 desc.add<
edm::InputTag>(
"jets")->setComment(
"a jet collection derived from pat::Jet");
363 desc.add<
edm::InputTag>(
"muons")->setComment(
"a muon collection derived from pat::Muon");
364 desc.add<
edm::InputTag>(
"electrons")->setComment(
"an electron collection derived from pat::Electron");
365 desc.add<
edm::InputTag>(
"photons")->setComment(
"a photon collection derived from pat::Photon");
366 desc.add<
edm::InputTag>(
"taus")->setComment(
"a tau collection derived from pat::Tau");
368 ->setComment(
"an optional electron collection derived from pat::Electron, empty=>not used");
370 ->setComment(
"an optional boosted tau collection derived from pat::Tau, empty=>not used");
372 ->setComment(
"an optional vertex collection derived from reco::VertexCompositePtrCandidate,empty=>not used");
373 descriptions.
add(
"patObjectCrossLinker",
desc);
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 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)
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
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_
edm::InputTag verticesTag_
edm::InputTag boostedTausTag_