47 double pow2(
double val) {
return val *
val; }
53 maxDR2ToClean_(pow2(iConfig.getParameter<double>(
"maxDRToClean"))) {
54 produces<std::vector<edm::Ptr<reco::Candidate>>>();
66 const std::vector<std::pair<float, float>>& etaPhisToMatch,
68 const float candEta = cand.
eta();
69 const float candPhi = cand.
phi();
70 for (
const auto& etaPhi : etaPhisToMatch) {
71 if (
reco::deltaR2(candEta, candPhi, etaPhi.first, etaPhi.second) <= maxDR2) {
83 auto outColl = std::make_unique<std::vector<edm::Ptr<reco::Candidate>>>();
88 std::vector<std::pair<float, float>> coll1EtaPhis;
89 for (
size_t objNr = 0; objNr < coll1Handle->size(); objNr++) {
91 coll1EtaPhis.push_back({objPtr->eta(), objPtr->phi()});
92 outColl->push_back(objPtr);
94 for (
size_t objNr = 0; objNr < coll2Handle->size(); objNr++) {
97 outColl->push_back(objPtr);
109 desc.
add<
double>(
"maxDRToClean", 0.05);
110 descriptions.
add(
"candMergerCleanOthersByDR", desc);
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const edm::EDGetTokenT< edm::View< reco::Candidate > > coll2Token_
#define DEFINE_FWK_MODULE(type)
const edm::EDGetTokenT< edm::View< reco::Candidate > > coll1Token_
const float maxDR2ToClean_
CandMergerCleanOthersByDR(const edm::ParameterSet &)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
~CandMergerCleanOthersByDR() override
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
void add(std::string const &label, ParameterSetDescription const &psetDescription)
virtual double phi() const =0
momentum azimuthal angle
virtual double eta() const =0
momentum pseudorapidity