CMS 3D CMS Logo

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

Public Types

typedef
reco::tau::RecoTauBuilderPlugin 
Builder
 
typedef boost::ptr_vector
< Builder
BuilderList
 
typedef
reco::tau::RecoTauModifierPlugin 
Modifier
 
typedef boost::ptr_vector
< Modifier
ModifierList
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Public Member Functions

void produce (edm::Event &evt, const edm::EventSetup &es)
 
 RecoTauProducer (const edm::ParameterSet &pset)
 
 ~RecoTauProducer ()
 
- 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 Attributes

BuilderList builders_
 
bool buildNullTaus_
 
edm::InputTag jetSrc_
 
ModifierList modifiers_
 
std::auto_ptr
< StringCutObjectSelector
< reco::PFTau > > 
outputSelector_
 
edm::InputTag piZeroSrc_
 

Additional Inherited Members

- 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

Definition at line 40 of file RecoTauProducer.cc.

Member Typedef Documentation

Definition at line 42 of file RecoTauProducer.cc.

typedef boost::ptr_vector<Builder> RecoTauProducer::BuilderList

Definition at line 44 of file RecoTauProducer.cc.

Definition at line 43 of file RecoTauProducer.cc.

typedef boost::ptr_vector<Modifier> RecoTauProducer::ModifierList

Definition at line 45 of file RecoTauProducer.cc.

Constructor & Destructor Documentation

RecoTauProducer::RecoTauProducer ( const edm::ParameterSet pset)
explicit

Definition at line 64 of file RecoTauProducer.cc.

References builders_, buildNullTaus_, SurfaceDeformationFactory::create(), edm::ParameterSet::exists(), reco::get(), edm::ParameterSet::getParameter(), jetSrc_, modifiers_, outputSelector_, piZeroSrc_, and elec_selection::selection().

64  {
65  jetSrc_ = pset.getParameter<edm::InputTag>("jetSrc");
66  piZeroSrc_ = pset.getParameter<edm::InputTag>("piZeroSrc");
67 
68  typedef std::vector<edm::ParameterSet> VPSet;
69  // Get each of our tau builders
70  const VPSet& builders = pset.getParameter<VPSet>("builders");
71  for (VPSet::const_iterator builderPSet = builders.begin();
72  builderPSet != builders.end(); ++builderPSet) {
73  // Get plugin name
74  const std::string& pluginType =
75  builderPSet->getParameter<std::string>("plugin");
76  // Build the plugin
77  builders_.push_back(
78  RecoTauBuilderPluginFactory::get()->create(pluginType, *builderPSet));
79  }
80 
81  const VPSet& modfiers = pset.getParameter<VPSet>("modifiers");
82  for (VPSet::const_iterator modfierPSet = modfiers.begin();
83  modfierPSet != modfiers.end(); ++modfierPSet) {
84  // Get plugin name
85  const std::string& pluginType =
86  modfierPSet->getParameter<std::string>("plugin");
87  // Build the plugin
88  modifiers_.push_back(
89  RecoTauModifierPluginFactory::get()->create(pluginType, *modfierPSet));
90  }
91 
92  // Check if we want to apply a final output selection
93  if (pset.exists("outputSelection")) {
94  std::string selection = pset.getParameter<std::string>("outputSelection");
95  if (selection != "") {
96  outputSelector_.reset(
98  }
99  }
100  buildNullTaus_ = pset.getParameter<bool>("buildNullTaus");
101  produces<reco::PFTauCollection>();
102 }
T getParameter(std::string const &) const
edm::InputTag piZeroSrc_
BuilderList builders_
bool exists(std::string const &parameterName) const
checks if a parameter exists
ModifierList modifiers_
std::auto_ptr< StringCutObjectSelector< reco::PFTau > > outputSelector_
edm::InputTag jetSrc_
SurfaceDeformation * create(int type, const std::vector< double > &params)
T get(const Candidate &c)
Definition: component.h:56
RecoTauProducer::~RecoTauProducer ( )
inline

Definition at line 48 of file RecoTauProducer.cc.

48 {}

Member Function Documentation

void RecoTauProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 104 of file RecoTauProducer.cc.

References builders_, buildNullTaus_, edm::Event::getByLabel(), analyzePatCleaning_cfg::jets, jetSrc_, modifiers_, convertSQLitetoXML_cfg::output, outputSelector_, piZeroSrc_, edm::Event::put(), reco::PFTau::setjetRef(), and metsig::tau.

104  {
105  // Get the jet input collection via a view of Candidates
107  evt.getByLabel(jetSrc_, jetView);
108 
109  // Convert to a vector of PFJetRefs
111  reco::tau::castView<reco::PFJetRefVector>(jetView);
112 
113  // Get the pizero input collection
115  evt.getByLabel(piZeroSrc_, piZeroAssoc);
116 
117  // Update all our builders and modifiers with the event info
118  for (BuilderList::iterator builder = builders_.begin();
119  builder != builders_.end(); ++builder) {
120  builder->setup(evt, es);
121  }
122  for (ModifierList::iterator modifier = modifiers_.begin();
123  modifier != modifiers_.end(); ++modifier) {
124  modifier->setup(evt, es);
125  }
126 
127  // Create output collection
128  std::auto_ptr<reco::PFTauCollection> output(new reco::PFTauCollection());
129 
130  // Loop over the jets and build the taus for each jet
131  BOOST_FOREACH(reco::PFJetRef jetRef, jets) {
132  // Get the PiZeros associated with this jet
133  const std::vector<reco::RecoTauPiZero>& piZeros = (*piZeroAssoc)[jetRef];
134  // Loop over our builders and create the set of taus for this jet
135  unsigned int nTausBuilt = 0;
136  for (BuilderList::const_iterator builder = builders_.begin();
137  builder != builders_.end(); ++builder) {
138  // Get a ptr_vector of taus from the builder
140  (*builder)(jetRef, piZeros));
141  // Check this size of the taus built.
142  // Grow the vector if necessary
143  output->reserve(output->size() + taus.size());
144  // Copy without selection
145  if (!outputSelector_.get()) {
146  output->insert(output->end(), taus.begin(), taus.end());
147  nTausBuilt += taus.size();
148  } else {
149  // Copy only those that pass the selection.
150  BOOST_FOREACH(const reco::PFTau& tau, taus) {
151  if ((*outputSelector_)(tau)) {
152  nTausBuilt++;
153  output->push_back(tau);
154  }
155  }
156  }
157  }
158  // If we didn't build *any* taus for this jet, build a null tau if desired.
159  // The null PFTau has no content, but it's four vector is set to that of the
160  // jet.
161  if (!nTausBuilt && buildNullTaus_) {
162  reco::PFTau nullTau(std::numeric_limits<int>::quiet_NaN(), jetRef->p4());
163  nullTau.setjetRef(jetRef);
164  output->push_back(nullTau);
165  }
166  }
167 
168  // Loop over the taus we have created and apply our modifiers to the taus
169  for (reco::PFTauCollection::iterator tau = output->begin();
170  tau != output->end(); ++tau) {
171  for (ModifierList::const_iterator modifier = modifiers_.begin();
172  modifier != modifiers_.end(); ++modifier) {
173  (*modifier)(*tau);
174  }
175  }
176  evt.put(output);
177 }
edm::InputTag piZeroSrc_
std::vector< PFTau > PFTauCollection
collection of PFTau objects
Definition: PFTauFwd.h:9
BuilderList builders_
boost::ptr_vector< reco::PFTau > output_type
ModifierList modifiers_
std::auto_ptr< StringCutObjectSelector< reco::PFTau > > outputSelector_
void setjetRef(const PFJetRef &)
Definition: PFTau.cc:51
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
edm::InputTag jetSrc_

Member Data Documentation

BuilderList RecoTauProducer::builders_
private

Definition at line 54 of file RecoTauProducer.cc.

Referenced by produce(), and RecoTauProducer().

bool RecoTauProducer::buildNullTaus_
private

Definition at line 61 of file RecoTauProducer.cc.

Referenced by produce(), and RecoTauProducer().

edm::InputTag RecoTauProducer::jetSrc_
private

Definition at line 52 of file RecoTauProducer.cc.

Referenced by produce(), and RecoTauProducer().

ModifierList RecoTauProducer::modifiers_
private

Definition at line 55 of file RecoTauProducer.cc.

Referenced by produce(), and RecoTauProducer().

std::auto_ptr<StringCutObjectSelector<reco::PFTau> > RecoTauProducer::outputSelector_
private

Definition at line 57 of file RecoTauProducer.cc.

Referenced by produce(), and RecoTauProducer().

edm::InputTag RecoTauProducer::piZeroSrc_
private

Definition at line 53 of file RecoTauProducer.cc.

Referenced by produce(), and RecoTauProducer().