78 static const std::regex re(
"^[+-]?(\\d+\\.?|\\d*\\.\\d*)$");
79 return regex_match(
str.c_str(), re);
85 deltaR_(iConfig.getParameter<double>(
"deltaR")),
86 weightExpr_(iConfig.getParameter<
std::
string>(
"weight")),
87 skipDefaultVeto_(iConfig.getParameter<
bool>(
"skipDefaultVeto")),
88 usePivotForBarrelEndcaps_(iConfig.getParameter<
bool>(
"PivotCoordinatesForEBEE"))
94 else if (
mode ==
"sumRelative")
96 else if (
mode ==
"sum2")
98 else if (
mode ==
"sum2Relative")
100 else if (
mode ==
"max")
102 else if (
mode ==
"maxRelative")
104 else if (
mode ==
"nearestDR")
106 else if (
mode ==
"count")
110 <<
"Supported modes are 'sum', 'sumRelative', 'count'." <<
112 "New methods can be easily implemented if requested.";
113 typedef std::vector<std::string>
vstring;
116 static const std::regex ecalSwitch(
"^Ecal(Barrel|Endcaps):(.*)");
118 for (vstring::const_iterator
it =
vetos.begin(), ed =
vetos.end();
it != ed; ++
it) {
122 if (regex_match(
it->c_str(),
match, ecalSwitch)) {
123 if (
match[1] ==
"Barrel") {
128 if (
match[1] ==
"Endcaps") {
156 for (AbsVetos::iterator
it = barrelVetos_.begin(), ed = barrelVetos_.end();
it != ed; ++
it) {
159 for (AbsVetos::iterator
it = endcapVetos_.begin(), ed = endcapVetos_.end();
it != ed; ++
it) {
162 barrelVetos_.clear();
163 endcapVetos_.clear();
168 iEvent.getByToken(srcToken_, hDeps_);
169 for (EventDependentAbsVetos::iterator
it = evdepVetos_.begin(), ed = evdepVetos_.end();
it != ed; ++
it) {
170 (*it)->setEvent(
iEvent, iSetup);
179 if (usePivotForBarrelEndcaps_) {
195 for (AbsVetos::iterator
it =
vetos->begin(), ed =
vetos->end();
it != ed; ++
it) {
196 (*it)->centerOn(
eta,
phi);
198 double weight = (usesFunction_ ? weightExpr_(*
cand) : weight_);
217 throw cms::Exception(
"Logic error") <<
"Should not happen at " << __FILE__ <<
", line " 223 typedef std::vector<edm::ParameterSet>
VPSet;
225 for (VPSet::const_iterator
it = depPSets.begin(), ed = depPSets.end();
it != ed; ++
it) {
229 throw cms::Exception(
"Configuration Error") <<
"Please specify at least one deposit!";
230 produces<CandDoubleMap>();
249 event.put(std::make_unique<CandDoubleMap>());
257 iterator_i depI =
map.begin();
258 iterator_i depIEnd =
map.end();
259 for (; depI != depIEnd; ++depI) {
260 std::vector<double> retV(depI.size(), 0);
262 event.get(depI.id(), candH);
265 iterator_ii depII = depI.
begin();
266 iterator_ii depIIEnd = depI.end();
268 for (; depII != depIIEnd; ++depII, ++iRet) {
271 sum +=
it->compute(candV.
refAt(iRet));
274 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
std::vector< SingleDeposit > sources_
RefToBase< value_type > refAt(size_type i) const
double compute(const reco::CandidateBaseRef &cand)
bool isNumber(const std::string &str) const
reco::isodeposit::AbsVetos endcapVetos_
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_
const math::XYZPointF & positionAtECALEntrance() const
double maxWithin(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
SingleDeposit(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
std::vector< EventDependentAbsVeto * > EventDependentAbsVetos
const reco::IsoDepositMap & map()
reco::isodeposit::AbsVetos barrelVetos_
~PFCandIsolatorFromDeposits() override
destructor
reco::isodeposit::EventDependentAbsVetos evdepVetos_
edm::Handle< reco::IsoDepositMap > hDeps_
double candEnergy() const
Get energy or pT attached to cand trajectory.
edm::EDGetTokenT< reco::IsoDepositMap > srcToken_
#define DEFINE_FWK_MODULE(type)
void produce(edm::Event &, const edm::EventSetup &) override
build deposits
PFCandIsolatorFromDeposits(const edm::ParameterSet &)
constructor with config
bool usePivotForBarrelEndcaps_
void open(const edm::Event &iEvent, const edm::EventSetup &iSetup)
virtual reco::SuperClusterRef superCluster() const
reference to a SuperCluster
Particle reconstructed by the particle flow algorithm.
double toNumber(const std::string &str) const
std::vector< AbsVeto * > AbsVetos
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
const_iterator begin() const
double countWithin(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
edm::ValueMap< double > CandDoubleMap