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 Attributes
PFTauMVAInputDiscriminantTranslator Class Reference
Inheritance diagram for PFTauMVAInputDiscriminantTranslator:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  DiscriminantInfo
 

Public Member Functions

 PFTauMVAInputDiscriminantTranslator (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

std::vector< DiscriminantInfodiscriminators_
 
edm::InputTag pfTauSource_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 29 of file PFTauMVAInputDiscriminantTranslator.cc.

Constructor & Destructor Documentation

PFTauMVAInputDiscriminantTranslator::PFTauMVAInputDiscriminantTranslator ( const edm::ParameterSet pset)

Definition at line 47 of file PFTauMVAInputDiscriminantTranslator.cc.

References ecaldqm::collectionName, PFTauMVAInputDiscriminantTranslator::DiscriminantInfo::collName, SurfaceDeformationFactory::create(), PFTauMVAInputDiscriminantTranslator::DiscriminantInfo::defaultValue, reco::tau::discPluginName(), reco::get(), edm::ParameterSet::getParameter(), PFTauMVAInputDiscriminantTranslator::DiscriminantInfo::index, cmsHarvester::index, PFTauMVAInputDiscriminantTranslator::DiscriminantInfo::name, mergeVDriftHistosByStation::name, PFTauMVAInputDiscriminantTranslator::DiscriminantInfo::plugin, and AlCaHLTBitMon_QueryRunRegistry::string.

48  {
49  typedef std::vector<edm::ParameterSet> VPSet;
50  pfTauSource_ = pset.getParameter<edm::InputTag>("pfTauSource");
51  VPSet discriminants = pset.getParameter<VPSet>("discriminants");
52 
53  for(VPSet::const_iterator iDisc = discriminants.begin();
54  iDisc != discriminants.end(); ++iDisc) {
55  // WTF IS GOING ON HERE
56  std::string name = iDisc->getParameter<std::string>("name");
57  double defaultValue = (iDisc->exists("default")) ?
58  iDisc->getParameter<double>("default") : 0.;
59  // check if we are getting multiple indices
60  bool requestMultiple = iDisc->exists("indices");
61  if(requestMultiple) {
62  // make a discrimiantor for each desired index
63  std::vector<uint32_t> indices =
64  iDisc->getParameter<std::vector<uint32_t> >("indices");
65  for(std::vector<uint32_t>::const_iterator index = indices.begin();
66  index != indices.end(); ++index) {
67  DiscriminantInfo newDisc;
68  newDisc.name = name;
69  newDisc.index = *index;
70  newDisc.defaultValue = defaultValue;
71  // make a nice colleciton name
72  std::stringstream collectionName;
73  collectionName << name << *index;
74  newDisc.collName = collectionName.str();
75  // Build the plugin
76  edm::ParameterSet fakePSet;
77  newDisc.plugin.reset(
79  reco::tau::discPluginName(name), fakePSet));
80  discriminators_.push_back(newDisc);
81  }
82  } else {
83  //single discriminant
84  DiscriminantInfo newDisc;
85  newDisc.name = name;
86  newDisc.collName = name;
87  newDisc.index = 0;
88  newDisc.defaultValue = defaultValue;
89  // Build the plugin
90  edm::ParameterSet fakePSet;
91  newDisc.plugin.reset(
93  reco::tau::discPluginName(name), fakePSet));
94  discriminators_.push_back(newDisc);
95  }
96  }
97  // register products
98  BOOST_FOREACH(const DiscriminantInfo& disc, discriminators_) {
99  produces<PFTauDiscriminator>(disc.collName);
100  }
101 }
T getParameter(std::string const &) const
std::string discPluginName(const std::string &mvaName)
std::string const collectionName[nCollections]
Definition: Collections.h:45
SurfaceDeformation * create(int type, const std::vector< double > &params)
T get(const Candidate &c)
Definition: component.h:55

Member Function Documentation

void PFTauMVAInputDiscriminantTranslator::produce ( edm::Event evt,
const edm::EventSetup es 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 103 of file PFTauMVAInputDiscriminantTranslator.cc.

References PFTauMVAInputDiscriminantTranslator::DiscriminantInfo::collName, PFTauMVAInputDiscriminantTranslator::DiscriminantInfo::defaultValue, edm::Event::getByLabel(), PFTauMVAInputDiscriminantTranslator::DiscriminantInfo::index, convertSQLitetoXML_cfg::output, pfTaus_cff::pfTaus, PFTauMVAInputDiscriminantTranslator::DiscriminantInfo::plugin, edm::Event::put(), and query::result.

104  {
105  // Handle to get PFTaus to associated to
107  evt.getByLabel(pfTauSource_, pfTaus);
108 
109  BOOST_FOREACH(const DiscriminantInfo& disc, discriminators_) {
110  // output for this discriminator
111  std::auto_ptr<PFTauDiscriminator> output(
113  // loop over taus
114  for(size_t itau = 0; itau < pfTaus->size(); ++itau) {
115  PFTauRef tauRef(pfTaus, itau);
116  // discriminator result
117  std::vector<double> result = (*disc.plugin)(tauRef);
118  // The desired index
119  double selected_result = disc.defaultValue;
120  if (result.size()-1 < disc.index) {
121  selected_result = result[disc.index];
122  }
123  output->setValue(itau, selected_result);
124  }
125  evt.put(output, disc.collName);
126  }
127 }
tuple pfTaus
Definition: pfTaus_cff.py:136
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
tuple result
Definition: query.py:137
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:413

Member Data Documentation

std::vector<DiscriminantInfo> PFTauMVAInputDiscriminantTranslator::discriminators_
private

Definition at line 44 of file PFTauMVAInputDiscriminantTranslator.cc.

edm::InputTag PFTauMVAInputDiscriminantTranslator::pfTauSource_
private

Definition at line 43 of file PFTauMVAInputDiscriminantTranslator.cc.