CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Types | Private Attributes
RecoTauCleanerImpl< Prod > Class Template Reference
Inheritance diagram for RecoTauCleanerImpl< Prod >:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Classes

class  RemoveDuplicateJets
 

Public Member Functions

void produce (edm::Event &evt, const edm::EventSetup &es)
 
 RecoTauCleanerImpl (const edm::ParameterSet &pset)
 
 ~RecoTauCleanerImpl ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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 elec_selection::selection().

68  {
69  tauSrc_ = pset.getParameter<edm::InputTag>("src");
70  // Build our list of quality plugins
71  typedef std::vector<edm::ParameterSet> VPSet;
72  // Get each of our tau builders
73  const VPSet& cleaners = pset.getParameter<VPSet>("cleaners");
74  for (VPSet::const_iterator cleanerPSet = cleaners.begin();
75  cleanerPSet != cleaners.end(); ++cleanerPSet) {
76  // Get plugin name
77  const std::string& pluginType =
78  cleanerPSet->getParameter<std::string>("plugin");
79  // Build the plugin
80  cleaners_.push_back(
81  RecoTauCleanerPluginFactory::get()->create(pluginType, *cleanerPSet));
82  }
83 
84  // Check if we want to apply a final output selection
85  if (pset.exists("outputSelection")) {
86  std::string selection = pset.getParameter<std::string>("outputSelection");
87  if (selection != "") {
88  outputSelector_.reset(
90  }
91  }
92 
93  // Build the predicate that ranks our taus. The predicate takes a list of
94  // cleaners, and uses them to create a lexicographic ranking.
95  predicate_ = std::auto_ptr<Predicate>(new Predicate(cleaners_));
96  produces<Prod>();
97 }
T getParameter(std::string const &) const
edm::InputTag tauSrc_
std::auto_ptr< StringCutObjectSelector< reco::PFTau > > outputSelector_
bool exists(std::string const &parameterName) const
checks if a parameter exists
CleanerList cleaners_
reco::tau::RecoTauLexicographicalRanking< CleanerList, reco::PFTauRef > Predicate
SurfaceDeformation * create(int type, const std::vector< double > &params)
T get(const Candidate &c)
Definition: component.h:56
std::auto_ptr< Predicate > predicate_
template<typename Prod >
RecoTauCleanerImpl< Prod >::~RecoTauCleanerImpl ( )
inline

Definition at line 53 of file RecoTauCleaner.cc.

53 {}

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(), collect_tpl::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.

117  {
118  // Update all our cleaners with the event info if they need it
119  for (CleanerList::iterator cleaner = cleaners_.begin();
120  cleaner != cleaners_.end(); ++cleaner) {
121  cleaner->setup(evt, es);
122  }
123 
124  // Get the input collection to clean
126  evt.getByLabel(tauSrc_, input);
127 
128  // Cast the input candidates to Refs to real taus
129  reco::PFTauRefVector inputRefs =
130  reco::tau::castView<reco::PFTauRefVector>(input);
131 
132  // Make an STL algorithm friendly vector of refs
133  typedef std::vector<reco::PFTauRef> PFTauRefs;
134  // Collection of all taus. Some are from the same PFJet. We must clean them.
135  PFTauRefs dirty;
136  dirty.reserve(inputRefs.size());
137  std::copy(inputRefs.begin(), inputRefs.end(), std::back_inserter(dirty));
138 
139  // Sort the input tau refs according to our predicate
140  std::sort(dirty.begin(), dirty.end(), *predicate_);
141 
142  // Clean the taus, ensuring that only one tau per jet is produced
143  PFTauRefs cleanTaus = reco::tau::cleanOverlaps<PFTauRefs,
144  RemoveDuplicateJets>(dirty);
145 
146  // create output collection
147  std::auto_ptr<Prod> output(new Prod());
148  //output->reserve(cleanTaus.size());
149 
150  // Copy clean refs into output
151  for (PFTauRefs::const_iterator tau = cleanTaus.begin();
152  tau != cleanTaus.end(); ++tau) {
153  // If we are applying an output selection, check if it passes
154  bool selected = true;
155  if (outputSelector_.get() && !(*outputSelector_)(**tau)) {
156  selected = false;
157  }
158  if (selected) {
159  output->push_back(convert<output_type>(*tau));
160  }
161  }
162  evt.put(output);
163 }
edm::InputTag tauSrc_
std::auto_ptr< StringCutObjectSelector< reco::PFTau > > outputSelector_
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:243
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:238
CleanerList cleaners_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
void reserve(size_type n)
Reserve space for RefVector.
Definition: RefVector.h:90
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
tuple input
Definition: collect_tpl.py:10
size_type size() const
Size of the RefVector.
Definition: RefVector.h:84
Container cleanOverlaps(const Container &dirty)
std::auto_ptr< Predicate > predicate_

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.