18 #include <boost/ptr_container/ptr_vector.hpp>
37 template<
typename Prod>
48 {
return a->jetRef() == b->jetRef(); }
63 template<
typename Prod>
67 typedef std::vector<edm::ParameterSet> VPSet;
69 const VPSet& cleaners = pset.
getParameter<VPSet>(
"cleaners");
70 for (VPSet::const_iterator cleanerPSet = cleaners.begin();
71 cleanerPSet != cleaners.end(); ++cleanerPSet) {
81 if (pset.
exists(
"outputSelection")) {
83 if (selection !=
"") {
84 outputSelector_.reset(
109 template<
typename Prod>
113 for (CleanerList::iterator cleaner = cleaners_.begin();
114 cleaner != cleaners_.end(); ++cleaner) {
115 cleaner->setup(evt, es);
124 reco::tau::castView<reco::PFTauRefVector>(
input);
127 typedef std::vector<reco::PFTauRef> PFTauRefs;
129 PFTauRefs dirty(inputRefs.
size());
132 auto N = inputRefs.
size();
133 auto CN = cleaners_.size();
135 for (decltype(N)
i=0;
i!=
N; ++
i) index[
i]=
i;
140 for (decltype(N) ir=0; ir!=
N; ++ir)
141 for(decltype(N) cl=0;cl!=
CN;++cl)
142 ranks[
ii++]=cleaners_[cl](inputRefs[ir]);
144 const float *
rr = ranks;
145 std::sort(index,index+N,[rr,CN](
int i,
int j) {
return std::lexicographical_compare(rr+i*CN,rr+i*CN+CN,rr+j*CN,rr+j*CN+CN);});
146 for (decltype(N) ir=0; ir!=
N; ++ir)
147 dirty[ir]=inputRefs[index[ir]];
154 std::auto_ptr<Prod>
output(
new Prod());
158 for (PFTauRefs::const_iterator
tau = cleanTaus.begin();
159 tau != cleanTaus.end(); ++
tau) {
161 bool selected =
true;
162 if (outputSelector_.get() && !(*outputSelector_)(**tau)) {
166 output->push_back(convert<output_type>(*
tau));
void produce(edm::Event &evt, const edm::EventSetup &es)
T getParameter(std::string const &) const
RecoTauCleanerImpl< reco::PFTauRefVector > RecoTauRefCleaner
std::auto_ptr< StringCutObjectSelector< reco::PFTau > > outputSelector_
#define DEFINE_FWK_MODULE(type)
bool operator()(const reco::PFTauRef &a, const reco::PFTauRef &b)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
RecoTauCleanerImpl< reco::PFTauCollection > RecoTauCleaner
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Container::value_type value_type
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
reco::tau::RecoTauCleanerPlugin Cleaner
boost::ptr_vector< Cleaner > CleanerList
size_type size() const
Size of the RefVector.
Container cleanOverlaps(const Container &dirty)
Prod::value_type output_type
T get(const Candidate &c)
RecoTauCleanerImpl(const edm::ParameterSet &pset)