CMS 3D CMS Logo

Classes | Public Member Functions | Private Types | Private Attributes

RecoTauCleanerImpl< Prod > Class Template Reference

Inheritance diagram for RecoTauCleanerImpl< Prod >:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

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
typedef
reco::tau::RecoTauLexicographicalRanking
< CleanerList, reco::PFTauRef
Predicate

Private Attributes

CleanerList cleaners_
std::auto_ptr
< StringCutObjectSelector
< reco::PFTau > > 
outputSelector_
std::auto_ptr< Predicatepredicate_
edm::InputTag tauSrc_

Detailed Description

template<typename Prod>
class RecoTauCleanerImpl< Prod >

Definition at line 38 of file RecoTauCleaner.cc.


Member Typedef Documentation

template<typename Prod >
typedef reco::tau::RecoTauCleanerPlugin RecoTauCleanerImpl< Prod >::Cleaner [private]

Definition at line 39 of file RecoTauCleaner.cc.

template<typename Prod >
typedef boost::ptr_vector<Cleaner> RecoTauCleanerImpl< Prod >::CleanerList [private]

Definition at line 40 of file RecoTauCleaner.cc.

template<typename Prod >
typedef Prod::value_type RecoTauCleanerImpl< Prod >::output_type [private]

Definition at line 42 of file RecoTauCleaner.cc.

Definition at line 59 of file RecoTauCleaner.cc.


Constructor & Destructor Documentation

template<typename Prod >
RecoTauCleanerImpl< Prod >::RecoTauCleanerImpl ( const edm::ParameterSet pset) [explicit]

Definition at line 68 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.  The predicate takes a list of
  // cleaners, and uses them to create a lexicographic ranking.
  predicate_ = std::auto_ptr<Predicate>(new Predicate(cleaners_));
  produces<Prod>();
}
template<typename Prod >
RecoTauCleanerImpl< Prod >::~RecoTauCleanerImpl ( ) [inline]

Definition at line 53 of file RecoTauCleaner.cc.

{}

Member Function Documentation

template<typename Prod >
void RecoTauCleanerImpl< Prod >::produce ( edm::Event evt,
const edm::EventSetup es 
) [virtual]

Implements edm::EDProducer.

Definition at line 116 of file RecoTauCleaner.cc.

References edm::RefVector< C, T, F >::begin(), reco::tau::cleanOverlaps(), filterCSVwithJSON::copy, edm::RefVector< C, T, F >::end(), edm::Event::getByLabel(), LaserDQM_cfg::input, convertSQLitetoXML_cfg::output, edm::Event::put(), edm::RefVector< C, T, F >::reserve(), 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;
  dirty.reserve(inputRefs.size());
  std::copy(inputRefs.begin(), inputRefs.end(), std::back_inserter(dirty));

  // Sort the input tau refs according to our predicate
  std::sort(dirty.begin(), dirty.end(), *predicate_);

  // 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);
}

Member Data Documentation

template<typename Prod >
CleanerList RecoTauCleanerImpl< Prod >::cleaners_ [private]

Definition at line 62 of file RecoTauCleaner.cc.

template<typename Prod >
std::auto_ptr<StringCutObjectSelector<reco::PFTau> > RecoTauCleanerImpl< Prod >::outputSelector_ [private]

Definition at line 64 of file RecoTauCleaner.cc.

template<typename Prod >
std::auto_ptr<Predicate> RecoTauCleanerImpl< Prod >::predicate_ [private]

Definition at line 60 of file RecoTauCleaner.cc.

template<typename Prod >
edm::InputTag RecoTauCleanerImpl< Prod >::tauSrc_ [private]

Definition at line 61 of file RecoTauCleaner.cc.