65 static const std::regex re(
"^[+-]?(\\d+\\.?|\\d*\\.\\d*)$");
66 return regex_match(
str.c_str(), re);
73 deltaR_(iConfig.getParameter<double>(
"deltaR")),
74 weightExpr_(iConfig.getParameter<
std::
string>(
"weight")),
75 skipDefaultVeto_(iConfig.getParameter<
bool>(
"skipDefaultVeto"))
81 else if (
mode ==
"sumRelative")
83 else if (
mode ==
"sum2")
85 else if (
mode ==
"sum2Relative")
87 else if (
mode ==
"max")
89 else if (
mode ==
"maxRelative")
91 else if (
mode ==
"nearestDR")
93 else if (
mode ==
"count")
95 else if (
mode ==
"meanDR")
97 else if (
mode ==
"sumDR")
101 <<
"Supported modes are 'sum', 'sumRelative', 'count'." <<
103 "New methods can be easily implemented if requested.";
104 typedef std::vector<std::string>
vstring;
107 for (vstring::const_iterator
it =
vetos.begin(), ed =
vetos.end();
it != ed; ++
it) {
124 for (AbsVetos::iterator
it = vetos_.begin(), ed = vetos_.end();
it != ed; ++
it) {
132 iEvent.getByToken(srcToken_, hDeps_);
133 for (EventDependentAbsVetos::iterator
it = evdepVetos_.begin(), ed = evdepVetos_.end();
it != ed; ++
it) {
134 (*it)->setEvent(
iEvent, iSetup);
142 for (AbsVetos::iterator
it = vetos_.begin(), ed = vetos_.end();
it != ed; ++
it) {
143 (*it)->centerOn(
eta,
phi);
145 double weight = (usesFunction_ ? weightExpr_(*
cand) : weight_);
168 throw cms::Exception(
"Logic error") <<
"Should not happen at " << __FILE__ <<
", line " 174 typedef std::vector<edm::ParameterSet>
VPSet;
176 for (VPSet::const_iterator
it = depPSets.begin(), ed = depPSets.end();
it != ed; ++
it) {
180 throw cms::Exception(
"Configuration Error") <<
"Please specify at least one deposit!";
181 produces<CandDoubleMap>();
200 event.put(std::make_unique<CandDoubleMap>());
203 auto ret = std::make_unique<CandDoubleMap>();
208 iterator_i depI =
map.begin();
209 iterator_i depIEnd =
map.end();
210 for (; depI != depIEnd; ++depI) {
211 std::vector<double> retV(depI.size(), 0);
213 event.get(depI.id(), candH);
216 iterator_ii depII = depI.
begin();
217 iterator_ii depIIEnd = depI.end();
219 for (; depII != depIIEnd; ++depII, ++iRet) {
222 sum +=
it->compute(candV.
refAt(iRet));
225 filler.insert(candH, retV.begin(), retV.end());
static reco::isodeposit::AbsVeto * make(const char *string, edm::ConsumesCollector &iC)
double sumWithin(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
T getParameter(std::string const &) const
double compute(const reco::CandidateBaseRef &cand)
RefToBase< value_type > refAt(size_type i) const
SingleDeposit(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
ret
prodAgent to be discontinued
double sum2Within(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
double nearestDR(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
StringObjectFunction< reco::Candidate > weightExpr_
std::vector< SingleDeposit > sources_
double maxWithin(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
edm::ValueMap< double > CandDoubleMap
edm::Handle< reco::IsoDepositMap > hDeps_
std::vector< EventDependentAbsVeto * > EventDependentAbsVetos
const reco::IsoDepositMap & map()
double candEnergy() const
Get energy or pT attached to cand trajectory.
void open(const edm::Event &iEvent, const edm::EventSetup &iSetup)
reco::isodeposit::AbsVetos vetos_
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< reco::IsoDepositMap > srcToken_
void produce(edm::Event &, const edm::EventSetup &) override
build deposits
~CandIsolatorFromDeposits() override
destructor
CandIsolatorFromDeposits(const edm::ParameterSet &)
constructor with config
std::vector< AbsVeto * > AbsVetos
reco::isodeposit::EventDependentAbsVetos evdepVetos_
const_iterator begin() const
double algoWithin(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
Get some info about the deposit (e.g. sum, max, sum2, count)
double countWithin(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const