16 produces<ObjectCollection>();
38 bool operator() (
const objectWithRank<T>& t1,
const objectWithRank<T>&
t2)
40 return (t1.rank_ > t2.rank_);
48 std::vector<objectWithRank<T> > selectedObjects;
51 for ( vInputTag::const_iterator src_i = src_.begin();
52 src_i != src_.end(); ++src_i ) {
55 for (
typename ObjectCollection::const_iterator
object = objects->begin();
56 object != objects->end(); ++object ) {
57 if ( !cut_ || (*cut_)(*object) ) {
58 objectWithRank<T> selectedObject;
59 selectedObject.object_ = &(*object);
60 selectedObject.rank_ = (*rank_)(*object);
61 selectedObjects.push_back(selectedObject);
67 higherRankT<T> higherRank;
68 std::sort(selectedObjects.begin(), selectedObjects.end(), higherRank);
72 if ( selectedObjects.size() > 0 ) objects_output->push_back(*selectedObjects.front().object_);
74 evt.
put(objects_output);
76 if ( filter_ )
return (objects_output->size() > 0);
T getParameter(std::string const &) const
UniqueObjectSelector< pat::Muon > UniquePATMuonSelector
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
bool filter(edm::Event &, const edm::EventSetup &)
#define DEFINE_FWK_MODULE(type)
std::vector< edm::InputTag > vInputTag
bool exists(std::string const ¶meterName) const
checks if a parameter exists
UniqueObjectSelector(const edm::ParameterSet &)
StringObjectFunction< T > * rank_
auto const T2 &decltype(t1.eta()) t2
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
UniqueObjectSelector< reco::CompositeCandidate > UniqueCompositeCandidateSelector
StringCutObjectSelector< T > * cut_
std::vector< T > ObjectCollection