48 objVar_(iConfig.getParameter<
std::
string>(
"expression")),
49 default_(iConfig.getParameter<double>(
"default")),
51 iConfig.existsAs<
std::
string>(
"objectSelection") ? iConfig.getParameter<
std::
string>(
"objectSelection") :
"",
53 doSort_(iConfig.existsAs<
std::
string>(
"objectSortDescendingBy")),
54 objSort_(doSort_ ? iConfig.getParameter<
std::
string>(
"objectSortDescendingBy") :
"1",
true) {
55 produces<edm::ValueMap<float>>();
68 iEvent.getByToken(probesToken_, probes);
72 std::vector<std::pair<double, double>> selected;
74 for (
object =
objects->begin();
object != endobjects; ++
object) {
75 if (objCut_(*
object)) {
76 selected.push_back(std::pair<double, double>(objSort_(*
object), objVar_(*
object)));
81 if (doSort_ && selected.size() > 1)
82 std::sort(selected.begin(), selected.end());
85 std::vector<float>
values(probes->size(), (selected.empty() ? default_ : selected.back().second));
88 auto valMap = std::make_unique<ValueMap<float>>();