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>>();
~OtherObjectVariableComputer() override
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
OtherObjectVariableComputer(const edm::ParameterSet &iConfig)
Matcher of number of reconstructed objects in the event to probe.
edm::EDGetTokenT< edm::View< reco::Candidate > > probesToken_
OtherObjectVariableComputer< reco::Candidate > OtherCandVariableComputer
edm::EDGetTokenT< edm::View< T > > objectsToken_
#define DEFINE_FWK_MODULE(type)
StringCutObjectSelector< T, true > objCut_
StringObjectFunction< T, true > objVar_
StringObjectFunction< T, true > objSort_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator