22 #include <boost/regex.hpp> 31 static boost::regex re(
"^[+-]?(\\d+\\.?|\\d*\\.\\d*)$");
32 return regex_match(str.c_str(), re);
35 return atof(str.c_str());
40 deltaR_(iConfig.getParameter<double>(
"deltaR")),
41 weightExpr_(iConfig.getParameter<
std::
string>(
"weight")),
42 skipDefaultVeto_(iConfig.getParameter<
bool>(
"skipDefaultVeto"))
56 else throw cms::Exception(
"Not Implemented") <<
"Mode '" << mode <<
"' not implemented. " <<
57 "Supported modes are 'sum', 'sumRelative', 'count'." <<
59 "New methods can be easily implemented if requested.";
60 typedef std::vector<std::string>
vstring;
63 for (vstring::const_iterator it = vetos.begin(), ed = vetos.end(); it != ed; ++it) {
79 for (AbsVetos::iterator it =
vetos_.begin(), ed =
vetos_.end(); it != ed; ++it) {
89 (*it)->setEvent(iEvent,iSetup);
97 for (AbsVetos::iterator it =
vetos_.begin(), ed =
vetos_.end(); it != ed; ++it) {
98 (*it)->centerOn(eta,
phi);
113 throw cms::Exception(
"Logic error") <<
"Should not happen at " << __FILE__ <<
", line " << __LINE__;
119 typedef std::vector<edm::ParameterSet>
VPSet;
121 for (VPSet::const_iterator it = depPSets.begin(), ed = depPSets.end(); it != ed; ++it) {
124 if (
sources_.size() == 0)
throw cms::Exception(
"Configuration Error") <<
"Please specify at least one deposit!";
125 produces<CandDoubleMap>();
131 for (it = begin; it !=
end; ++it) it->cleanup();
138 for (it = begin; it !=
end; ++it) it->open(event, eventSetup);
143 event.put(std::make_unique<CandDoubleMap>());
146 auto ret = std::make_unique<CandDoubleMap>();
149 typedef reco::IsoDepositMap::const_iterator iterator_i;
150 typedef reco::IsoDepositMap::container::const_iterator iterator_ii;
151 iterator_i depI = map.
begin();
152 iterator_i depIEnd = map.
end();
153 for (; depI != depIEnd; ++depI){
154 std::vector<double> retV(depI.size(),0);
156 event.get(depI.id(), candH);
159 iterator_ii depII = depI.
begin();
160 iterator_ii depIIEnd = depI.end();
162 for (; depII != depIIEnd; ++depII,++iRet){
164 for (it = begin; it !=
end; ++it) sum += it->compute(candV.
refAt(iRet));
167 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.
bool isNumber(const std::string &str)
double sum2Within(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
double compute(const reco::CandidateBaseRef &cand)
const_iterator end() const
SingleDeposit(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
double algoWithin(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
Get some info about the deposit (e.g. sum, max, sum2, count)
StringObjectFunction< reco::Candidate > weightExpr_
std::vector< SingleDeposit > sources_
double countWithin(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
double maxWithin(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
edm::Handle< reco::IsoDepositMap > hDeps_
double sumWithin(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
RefToBase< value_type > refAt(size_type i) const
double toNumber(const std::string &str)
const_iterator begin() const
const reco::IsoDepositMap & map()
double nearestDR(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
void open(const edm::Event &iEvent, const edm::EventSetup &iSetup)
reco::isodeposit::AbsVetos vetos_
edm::EDGetTokenT< reco::IsoDepositMap > srcToken_
virtual ~CandIsolatorFromDeposits()
destructor
const_iterator begin() const
CandIsolatorFromDeposits(const edm::ParameterSet &)
constructor with config
reco::isodeposit::EventDependentAbsVetos evdepVetos_
virtual void produce(edm::Event &, const edm::EventSetup &)
build deposits