35 static const std::regex re(
"^[+-]?(\\d+\\.?|\\d*\\.\\d*)$");
36 return regex_match(
str.c_str(), re);
42 deltaR_(iConfig.getParameter<double>(
"deltaR")),
43 weightExpr_(iConfig.getParameter<
std::
string>(
"weight")),
44 skipDefaultVeto_(iConfig.getParameter<
bool>(
"skipDefaultVeto")),
45 usePivotForBarrelEndcaps_(iConfig.getParameter<
bool>(
"PivotCoordinatesForEBEE"))
51 else if (
mode ==
"sumRelative")
53 else if (
mode ==
"sum2")
55 else if (
mode ==
"sum2Relative")
57 else if (
mode ==
"max")
59 else if (
mode ==
"maxRelative")
61 else if (
mode ==
"nearestDR")
63 else if (
mode ==
"count")
67 <<
"Supported modes are 'sum', 'sumRelative', 'count'." <<
69 "New methods can be easily implemented if requested.";
70 typedef std::vector<std::string>
vstring;
73 static const std::regex ecalSwitch(
"^Ecal(Barrel|Endcaps):(.*)");
75 for (vstring::const_iterator it =
vetos.begin(), ed =
vetos.end(); it != ed; ++it) {
79 if (regex_match(it->c_str(),
match, ecalSwitch)) {
80 if (
match[1] ==
"Barrel") {
85 if (
match[1] ==
"Endcaps") {
113 for (AbsVetos::iterator it = barrelVetos_.begin(), ed = barrelVetos_.end(); it != ed; ++it) {
116 for (AbsVetos::iterator it = endcapVetos_.begin(), ed = endcapVetos_.end(); it != ed; ++it) {
119 barrelVetos_.clear();
120 endcapVetos_.clear();
125 iEvent.getByToken(srcToken_, hDeps_);
126 for (EventDependentAbsVetos::iterator it = evdepVetos_.begin(), ed = evdepVetos_.end(); it != ed; ++it) {
127 (*it)->setEvent(
iEvent, iSetup);
136 if (usePivotForBarrelEndcaps_) {
152 for (AbsVetos::iterator it =
vetos->begin(), ed =
vetos->end(); it != ed; ++it) {
153 (*it)->centerOn(
eta,
phi);
155 double weight = (usesFunction_ ? weightExpr_(*
cand) : weight_);
174 throw cms::Exception(
"Logic error") <<
"Should not happen at " << __FILE__ <<
", line "
180 typedef std::vector<edm::ParameterSet>
VPSet;
182 for (VPSet::const_iterator it = depPSets.begin(), ed = depPSets.end(); it != ed; ++it) {
186 throw cms::Exception(
"Configuration Error") <<
"Please specify at least one deposit!";
187 produces<CandDoubleMap>();
193 for (it = begin; it !=
end; ++it)
200 for (it = begin; it !=
end; ++it)
201 it->open(
event, eventSetup);
206 event.put(std::make_unique<CandDoubleMap>());
214 iterator_i depI =
map.begin();
215 iterator_i depIEnd =
map.end();
216 for (; depI != depIEnd; ++depI) {
217 std::vector<double> retV(depI.size(), 0);
219 event.get(depI.id(), candH);
222 iterator_ii depII = depI.
begin();
223 iterator_ii depIIEnd = depI.end();
225 for (; depII != depIIEnd; ++depII, ++iRet) {
227 for (it = begin; it !=
end; ++it)
228 sum += it->compute(candV.
refAt(iRet));
231 filler.insert(candH, retV.begin(), retV.end());