Classes | |
class | RemoveDuplicateJets |
Public Member Functions | |
void | produce (edm::Event &evt, const edm::EventSetup &es) |
RecoTauCleanerImpl (const edm::ParameterSet &pset) | |
~RecoTauCleanerImpl () | |
Private Types | |
typedef reco::tau::RecoTauCleanerPlugin | Cleaner |
typedef boost::ptr_vector < Cleaner > | CleanerList |
typedef Prod::value_type | output_type |
Private Attributes | |
CleanerList | cleaners_ |
std::auto_ptr < StringCutObjectSelector < reco::PFTau > > | outputSelector_ |
edm::InputTag | tauSrc_ |
Definition at line 38 of file RecoTauCleaner.cc.
typedef reco::tau::RecoTauCleanerPlugin RecoTauCleanerImpl< Prod >::Cleaner [private] |
Definition at line 39 of file RecoTauCleaner.cc.
typedef boost::ptr_vector<Cleaner> RecoTauCleanerImpl< Prod >::CleanerList [private] |
Definition at line 40 of file RecoTauCleaner.cc.
typedef Prod::value_type RecoTauCleanerImpl< Prod >::output_type [private] |
Definition at line 42 of file RecoTauCleaner.cc.
RecoTauCleanerImpl< Prod >::RecoTauCleanerImpl | ( | const edm::ParameterSet & | pset | ) | [explicit] |
Definition at line 64 of file RecoTauCleaner.cc.
References SurfaceDeformationFactory::create(), edm::ParameterSet::exists(), reco::get(), edm::ParameterSet::getParameter(), and corrVsCorr::selection.
{ tauSrc_ = pset.getParameter<edm::InputTag>("src"); // Build our list of quality plugins typedef std::vector<edm::ParameterSet> VPSet; // Get each of our tau builders const VPSet& cleaners = pset.getParameter<VPSet>("cleaners"); for (VPSet::const_iterator cleanerPSet = cleaners.begin(); cleanerPSet != cleaners.end(); ++cleanerPSet) { // Get plugin name const std::string& pluginType = cleanerPSet->getParameter<std::string>("plugin"); // Build the plugin cleaners_.push_back( RecoTauCleanerPluginFactory::get()->create(pluginType, *cleanerPSet)); } // Check if we want to apply a final output selection if (pset.exists("outputSelection")) { std::string selection = pset.getParameter<std::string>("outputSelection"); if (selection != "") { outputSelector_.reset( new StringCutObjectSelector<reco::PFTau>(selection)); } } // Build the predicate that ranks our taus. produces<Prod>(); }
RecoTauCleanerImpl< Prod >::~RecoTauCleanerImpl | ( | ) | [inline] |
Definition at line 53 of file RecoTauCleaner.cc.
{}
void RecoTauCleanerImpl< Prod >::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | es | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 110 of file RecoTauCleaner.cc.
References cl, reco::tau::cleanOverlaps(), edm::Event::getByLabel(), i, getHLTprescales::index, LaserDQM_cfg::input, j, N, convertSQLitetoXML_cfg::output, edm::Event::put(), findQualityFiles::rr, edm::RefVector< C, T, F >::size(), python::multivaluedict::sort(), and metsig::tau.
{ // Update all our cleaners with the event info if they need it for (CleanerList::iterator cleaner = cleaners_.begin(); cleaner != cleaners_.end(); ++cleaner) { cleaner->setup(evt, es); } // Get the input collection to clean edm::Handle<reco::CandidateView> input; evt.getByLabel(tauSrc_, input); // Cast the input candidates to Refs to real taus reco::PFTauRefVector inputRefs = reco::tau::castView<reco::PFTauRefVector>(input); // Make an STL algorithm friendly vector of refs typedef std::vector<reco::PFTauRef> PFTauRefs; // Collection of all taus. Some are from the same PFJet. We must clean them. PFTauRefs dirty(inputRefs.size()); // Sort the input tau refs according to our predicate auto N = inputRefs.size(); auto CN = cleaners_.size(); int index[N]; for (decltype(N) i=0; i!=N; ++i) index[i]=i; float ranks[N*CN]; // auto ranks = [rr,CN](int i, int j){return rr[i*CN+j];}; // float const * * rr = ranks; decltype(N) ii=0; for (decltype(N) ir=0; ir!=N; ++ir) for(decltype(N) cl=0;cl!=CN;++cl) ranks[ii++]=cleaners_[cl](inputRefs[ir]); assert(ii==(N*CN)); const float * rr = ranks; 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);}); for (decltype(N) ir=0; ir!=N; ++ir) dirty[ir]=inputRefs[index[ir]]; // Clean the taus, ensuring that only one tau per jet is produced PFTauRefs cleanTaus = reco::tau::cleanOverlaps<PFTauRefs, RemoveDuplicateJets>(dirty); // create output collection std::auto_ptr<Prod> output(new Prod()); //output->reserve(cleanTaus.size()); // Copy clean refs into output for (PFTauRefs::const_iterator tau = cleanTaus.begin(); tau != cleanTaus.end(); ++tau) { // If we are applying an output selection, check if it passes bool selected = true; if (outputSelector_.get() && !(*outputSelector_)(**tau)) { selected = false; } if (selected) { output->push_back(convert<output_type>(*tau)); } } evt.put(output); }
CleanerList RecoTauCleanerImpl< Prod >::cleaners_ [private] |
Definition at line 58 of file RecoTauCleaner.cc.
std::auto_ptr<StringCutObjectSelector<reco::PFTau> > RecoTauCleanerImpl< Prod >::outputSelector_ [private] |
Definition at line 60 of file RecoTauCleaner.cc.
edm::InputTag RecoTauCleanerImpl< Prod >::tauSrc_ [private] |
Definition at line 57 of file RecoTauCleaner.cc.