64 static const std::regex re(
"^[+-]?(\\d+\\.?|\\d*\\.\\d*)$");
65 return regex_match(
str.c_str(), re);
71 deltaR_(iConfig.getParameter<double>(
"deltaR")),
72 weightExpr_(iConfig.getParameter<
std::
string>(
"weight")),
73 skipDefaultVeto_(iConfig.getParameter<
bool>(
"skipDefaultVeto"))
79 else if (
mode ==
"sumRelative")
81 else if (
mode ==
"sum2")
83 else if (
mode ==
"sum2Relative")
85 else if (
mode ==
"max")
87 else if (
mode ==
"maxRelative")
89 else if (
mode ==
"nearestDR")
91 else if (
mode ==
"count")
93 else if (
mode ==
"meanDR")
95 else if (
mode ==
"sumDR")
99 <<
"Supported modes are 'sum', 'sumRelative', 'count'." <<
101 "New methods can be easily implemented if requested.";
102 typedef std::vector<std::string>
vstring;
105 for (vstring::const_iterator it =
vetos.begin(), ed =
vetos.end(); it != ed; ++it) {
122 for (AbsVetos::iterator it = vetos_.begin(), ed = vetos_.end(); it != ed; ++it) {
130 iEvent.getByToken(srcToken_, hDeps_);
131 for (EventDependentAbsVetos::iterator it = evdepVetos_.begin(), ed = evdepVetos_.end(); it != ed; ++it) {
132 (*it)->setEvent(
iEvent, iSetup);
140 for (AbsVetos::iterator it = vetos_.begin(), ed = vetos_.end(); it != ed; ++it) {
141 (*it)->centerOn(
eta,
phi);
143 double weight = (usesFunction_ ? weightExpr_(*
cand) : weight_);
166 throw cms::Exception(
"Logic error") <<
"Should not happen at " << __FILE__ <<
", line " 172 typedef std::vector<edm::ParameterSet>
VPSet;
174 for (VPSet::const_iterator it = depPSets.begin(), ed = depPSets.end(); it != ed; ++it) {
178 throw cms::Exception(
"Configuration Error") <<
"Please specify at least one deposit!";
179 produces<CandDoubleMap>();
185 for (it = begin; it !=
end; ++it)
192 for (it = begin; it !=
end; ++it)
198 event.put(std::make_unique<CandDoubleMap>());
201 auto ret = std::make_unique<CandDoubleMap>();
206 iterator_i depI =
map.begin();
207 iterator_i depIEnd =
map.end();
208 for (; depI != depIEnd; ++depI) {
209 std::vector<double> retV(depI.size(), 0);
211 event.get(depI.id(), candH);
214 iterator_ii depII = depI.
begin();
215 iterator_ii depIIEnd = depI.end();
217 for (; depII != depIIEnd; ++depII, ++iRet) {
219 for (it = begin; it !=
end; ++it)
220 sum += it->compute(candV.
refAt(iRet));
223 filler.insert(candH, retV.begin(), retV.end());
static reco::isodeposit::AbsVeto * make(const char *string, edm::ConsumesCollector &iC)
bool isNumber(const std::string &str)
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
#define DEFINE_FWK_MODULE(type)
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
double toNumber(const std::string &str)
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_
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