33 static const std::regex re(
"^[+-]?(\\d+\\.?|\\d*\\.\\d*)$");
34 return regex_match(str.c_str(), re);
40 deltaR_(iConfig.getParameter<double>(
"deltaR")),
41 weightExpr_(iConfig.getParameter<
std::
string>(
"weight")),
42 skipDefaultVeto_(iConfig.getParameter<
bool>(
"skipDefaultVeto")),
43 usePivotForBarrelEndcaps_(iConfig.getParameter<
bool>(
"PivotCoordinatesForEBEE"))
49 else if (mode ==
"sumRelative")
51 else if (mode ==
"sum2")
53 else if (mode ==
"sum2Relative")
55 else if (mode ==
"max")
57 else if (mode ==
"maxRelative")
59 else if (mode ==
"nearestDR")
61 else if (mode ==
"count")
64 throw cms::Exception(
"Not Implemented") <<
"Mode '" << mode <<
"' not implemented. " 65 <<
"Supported modes are 'sum', 'sumRelative', 'count'." <<
67 "New methods can be easily implemented if requested.";
68 typedef std::vector<std::string>
vstring;
71 static const std::regex ecalSwitch(
"^Ecal(Barrel|Endcaps):(.*)");
73 for (vstring::const_iterator it = vetos.begin(), ed = vetos.end(); it != ed; ++it) {
77 if (regex_match(it->c_str(),
match, ecalSwitch)) {
78 if (match[1] ==
"Barrel") {
83 if (match[1] ==
"Endcaps") {
125 (*it)->setEvent(iEvent, iSetup);
143 barrel = (fabs(myRecoCand->
superCluster()->eta()) < 1.479);
150 for (AbsVetos::iterator it = vetos->begin(), ed = vetos->end(); it != ed; ++it) {
151 (*it)->centerOn(eta,
phi);
172 throw cms::Exception(
"Logic error") <<
"Should not happen at " << __FILE__ <<
", line " 178 typedef std::vector<edm::ParameterSet>
VPSet;
180 for (VPSet::const_iterator it = depPSets.begin(), ed = depPSets.end(); it != ed; ++it) {
184 throw cms::Exception(
"Configuration Error") <<
"Please specify at least one deposit!";
185 produces<CandDoubleMap>();
191 for (it = begin; it !=
end; ++it)
198 for (it = begin; it !=
end; ++it)
199 it->open(event, eventSetup);
204 event.put(std::unique_ptr<CandDoubleMap>(
new CandDoubleMap()));
212 iterator_i depI = map.
begin();
213 iterator_i depIEnd = map.
end();
214 for (; depI != depIEnd; ++depI) {
215 std::vector<double> retV(depI.size(), 0);
217 event.get(depI.id(), candH);
220 iterator_ii depII = depI.
begin();
221 iterator_ii depIIEnd = depI.end();
223 for (; depII != depIIEnd; ++depII, ++iRet) {
225 for (it = begin; it !=
end; ++it)
226 sum += it->compute(candV.
refAt(iRet));
229 filler.
insert(candH, retV.begin(), retV.end());
static reco::isodeposit::AbsVeto * make(const char *string, edm::ConsumesCollector &iC)
T getParameter(std::string const &) const
double candEnergy() const
Get energy or pT attached to cand trajectory.
double sum2Within(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
std::vector< SingleDeposit > sources_
const_iterator end() const
double compute(const reco::CandidateBaseRef &cand)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
reco::isodeposit::AbsVetos endcapVetos_
ret
prodAgent to be discontinued
void insert(const H &h, I begin, I end)
StringObjectFunction< reco::Candidate > weightExpr_
double countWithin(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
SingleDeposit(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
double maxWithin(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
const math::XYZPointF & positionAtECALEntrance() const
double sumWithin(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
const reco::IsoDepositMap & map()
reco::isodeposit::AbsVetos barrelVetos_
RefToBase< value_type > refAt(size_type i) const
~PFCandIsolatorFromDeposits() override
destructor
#define DEFINE_FWK_MODULE(type)
reco::isodeposit::EventDependentAbsVetos evdepVetos_
const_iterator begin() const
edm::Handle< reco::IsoDepositMap > hDeps_
double nearestDR(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
edm::EDGetTokenT< reco::IsoDepositMap > srcToken_
bool isNumber(const std::string &str) const
void produce(edm::Event &, const edm::EventSetup &) override
build deposits
PFCandIsolatorFromDeposits(const edm::ParameterSet &)
constructor with config
bool usePivotForBarrelEndcaps_
const_iterator begin() const
void open(const edm::Event &iEvent, const edm::EventSetup &iSetup)
Particle reconstructed by the particle flow algorithm.
std::vector< AbsVeto * > AbsVetos
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
double toNumber(const std::string &str) const
edm::ValueMap< double > CandDoubleMap
virtual reco::SuperClusterRef superCluster() const
reference to a SuperCluster