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")
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") {
111 for (AbsVetos::iterator it = barrelVetos_.begin(), ed = barrelVetos_.end(); it != ed; ++it) {
114 for (AbsVetos::iterator it = endcapVetos_.begin(), ed = endcapVetos_.end(); it != ed; ++it) {
117 barrelVetos_.clear();
118 endcapVetos_.clear();
123 iEvent.getByToken(srcToken_, hDeps_);
124 for (EventDependentAbsVetos::iterator it = evdepVetos_.begin(), ed = evdepVetos_.end(); it != ed; ++it) {
125 (*it)->setEvent(
iEvent, iSetup);
134 if (usePivotForBarrelEndcaps_) {
150 for (AbsVetos::iterator it =
vetos->begin(), ed =
vetos->end(); it != ed; ++it) {
151 (*it)->centerOn(
eta,
phi);
153 double weight = (usesFunction_ ? weightExpr_(*
cand) : weight_);
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>();
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) {
226 sum += it->compute(candV.
refAt(iRet));
229 filler.insert(candH, retV.begin(), retV.end());