47 probes_(iConfig.getParameter<edm::InputTag>(
"probes")),
48 objects_(iConfig.getParameter<edm::InputTag>(
"objects")),
49 objVar_(iConfig.getParameter<std::string>(
"expression")),
50 default_(iConfig.getParameter<double>(
"default")),
51 objCut_(iConfig.existsAs<std::string>(
"objectSelection") ? iConfig.getParameter<std::string>(
"objectSelection") :
"",
true),
52 doSort_(iConfig.existsAs<std::string>(
"objectSortDescendingBy")),
53 objSort_(doSort_ ? iConfig.getParameter<std::string>(
"objectSortDescendingBy") :
"1",
true)
55 produces<edm::ValueMap<float> >();
76 std::vector<std::pair<double, double> > selected;
78 for (
object = objects->begin();
object != endobjects; ++
object) {
79 if (objCut_(*
object)) {
80 selected.push_back(std::pair<double, double>(objSort_(*
object), objVar_(*
object)));
84 if (doSort_ && selected.size() > 1)
std::sort(selected.begin(), selected.end());
87 std::vector<float>
values(probes->size(), (selected.empty() ? default_ : selected.back().second));
92 filler.insert(probes, values.begin(), values.end());
StringCutObjectSelector< T, true > objCut_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
OtherObjectVariableComputer(const edm::ParameterSet &iConfig)
Matcher of number of reconstructed objects in the event to probe.
#define DEFINE_FWK_MODULE(type)
StringObjectFunction< T, true > objSort_
StringObjectFunction< T, true > objVar_
virtual ~OtherObjectVariableComputer()
OtherObjectVariableComputer< reco::Candidate > OtherCandVariableComputer
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup)