47 probesToken_(consumes<edm::
View<
reco::
Candidate> >(iConfig.getParameter<edm::InputTag>(
"probes"))),
48 objectsToken_(consumes<edm::
View<
T> >(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) {
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_
virtual 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.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
StringObjectFunction< T, true > objSort_
objCut_(iConfig.existsAs< std::string >("srcObjectSelection")?iConfig.getParameter< std::string >("srcObjectSelection"):"", true)
StringObjectFunction< T, true > objVar_
virtual ~OtherObjectVariableComputer()
edm::EDGetTokenT< edm::View< reco::Candidate > > probesToken_
OtherObjectVariableComputer< reco::Candidate > OtherCandVariableComputer
edm::EDGetTokenT< edm::View< T > > objectsToken_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator