CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Attributes
RecoTauMVATransform Class Reference
Inheritance diagram for RecoTauMVATransform:
TauDiscriminationProducerBase< TauType, TauDiscriminator > edm::stream::EDProducer<>

Public Member Functions

void beginEvent (const edm::Event &, const edm::EventSetup &) override
 
double discriminate (const reco::PFTauRef &) const override
 
 RecoTauMVATransform (const edm::ParameterSet &pset)
 
 ~RecoTauMVATransform () override
 
- Public Member Functions inherited from TauDiscriminationProducerBase< TauType, TauDiscriminator >
virtual double discriminate (const TauRef &tau) const =0
 
virtual void endEvent (edm::Event &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 TauDiscriminationProducerBase (const edm::ParameterSet &iConfig)
 
 TauDiscriminationProducerBase ()
 
 ~TauDiscriminationProducerBase () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from TauDiscriminationProducerBase< TauType, TauDiscriminator >
static void fillProducerDescriptions (edm::ParameterSetDescription &desc)
 
static std::string getTauTypeString ()
 helper method to retrieve tau type name, e.g. to build correct cfi getter More...
 

Private Types

typedef boost::ptr_map< reco::PFTau::hadronicDecayMode, TGraph > TransformMap
 

Private Attributes

edm::Handle< reco::PFTauDiscriminatordisc_
 
edm::InputTag input_
 
TransformMap transforms_
 

Additional Inherited Members

- Public Types inherited from TauDiscriminationProducerBase< TauType, TauDiscriminator >
typedef std::vector< TauType > TauCollection
 
typedef edm::Ref< TauCollectionTauRef
 
typedef edm::RefProd< TauCollectionTauRefProd
 
- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Protected Attributes inherited from TauDiscriminationProducerBase< TauType, TauDiscriminator >
std::string moduleLabel_
 
double prediscriminantFailValue_
 
edm::EDGetTokenT< TauCollectionTau_token
 
size_t tauIndex_
 
edm::InputTag TauProducer_
 

Detailed Description

Definition at line 47 of file RecoTauMVATransform.cc.

Member Typedef Documentation

typedef boost::ptr_map<reco::PFTau::hadronicDecayMode, TGraph> RecoTauMVATransform::TransformMap
private

Definition at line 58 of file RecoTauMVATransform.cc.

Constructor & Destructor Documentation

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

Definition at line 66 of file RecoTauMVATransform.cc.

References boostedTaus_cff::decayMode, edm::ParameterSet::getParameter(), input_, hpstanc_transforms::nCharged, hpstanc_transforms::nPiZeros, TauDiscriminationProducerBase< TauType, TauDiscriminator >::prediscriminantFailValue_, create_public_lumi_plots::transform, hpstanc_transforms::transforms, transforms_, reco::tau::translateDecayMode(), and HistogramManager_cfi::VPSet().

68  input_ = pset.getParameter<edm::InputTag>("toTransform");
69  typedef std::vector<edm::ParameterSet> VPSet;
70  const VPSet& transforms = pset.getParameter<VPSet>("transforms");
72  for(auto const& transform : transforms) {
73  unsigned int nCharged = transform.getParameter<unsigned int>("nCharged");
74  unsigned int nPiZeros = transform.getParameter<unsigned int>("nPiZeros");
75  // Get the transform
76  const edm::ParameterSet &transformImpl =
77  transform.getParameter<edm::ParameterSet>("transform");
78  // Get the acutal decay mode
80  reco::tau::translateDecayMode(nCharged, nPiZeros);
81 
82  if (!transforms_.count(decayMode)) {
83  // Add it
84  transforms_.insert(decayMode, buildTransform(transformImpl).get());
85  } else {
86  edm::LogError("DecayModeNotUnique") << "The tau decay mode with "
87  "nCharged/nPiZero = " << nCharged << "/" << nPiZeros <<
88  " dm: " << decayMode <<
89  " is associated to multiple MVA transforms, "
90  "the second instantiation is being ignored!!!";
91  }
92  }
93 }
T getParameter(std::string const &) const
PFTau::hadronicDecayMode translateDecayMode(unsigned int nCharged, unsigned int nPiZero)
TauDiscriminationProducerBase< reco::PFTau, reco::PFTauDiscriminator > PFTauDiscriminationProducerBase
hadronicDecayMode
Definition: PFTau.h:36
RecoTauMVATransform::~RecoTauMVATransform ( )
inlineoverride

Definition at line 50 of file RecoTauMVATransform.cc.

References beginEvent(), discriminate(), and fillDescriptions().

50 {}

Member Function Documentation

void RecoTauMVATransform::beginEvent ( const edm::Event evt,
const edm::EventSetup  
)
overridevirtual

Reimplemented from TauDiscriminationProducerBase< TauType, TauDiscriminator >.

Definition at line 97 of file RecoTauMVATransform.cc.

References disc_, edm::Event::getByLabel(), and input_.

Referenced by ~RecoTauMVATransform().

97  {
98  evt.getByLabel(input_, disc_);
99 }
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
edm::Handle< reco::PFTauDiscriminator > disc_
double RecoTauMVATransform::discriminate ( const reco::PFTauRef tau) const
override

Definition at line 101 of file RecoTauMVATransform.cc.

References TauDiscriminationProducerBase< TauType, TauDiscriminator >::prediscriminantFailValue_, mps_fire::result, metsig::tau, create_public_lumi_plots::transform, and transforms_.

Referenced by ~RecoTauMVATransform().

101  {
102  // Check if we support this decay mode:
103  TransformMap::const_iterator transformIter =
104  transforms_.find(tau->decayMode());
105  // Unsupported DM
106  if (transformIter == transforms_.end())
108  const TGraph *transform = transformIter->second;
109  // Get the discriminator output to transform
110  double value = (*disc_)[tau];
111  double result = transform->Eval(value);
112  return result;
113 }
Definition: value.py:1
void RecoTauMVATransform::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 116 of file RecoTauMVATransform.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addVPSet(), DEFINE_FWK_MODULE, and TauDiscriminationProducerBase< TauType, TauDiscriminator >::fillProducerDescriptions().

Referenced by ~RecoTauMVATransform().

116  {
117  // recoTauMVATransform
119 
120  desc.add<edm::InputTag>("toTransform");
121 
122  edm::ParameterSetDescription vpsd_transforms;
123  vpsd_transforms.add<uint32_t>("nCharged");
124  vpsd_transforms.add<uint32_t>("nPiZeros");
125 
126  edm::ParameterSetDescription pset_transform;
127  pset_transform.add<double>("min");
128  pset_transform.add<double>("max");
129  pset_transform.add<std::vector<double>>("transform");
130  vpsd_transforms.add<edm::ParameterSetDescription>("transform", pset_transform);
131 
132  // name description no defaults items
133  desc.addVPSet("transforms", vpsd_transforms);
134 
135  fillProducerDescriptions(desc); // inherited from the base
136 
137  descriptions.add("recoTauMVATransform", desc);
138 }
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
static void fillProducerDescriptions(edm::ParameterSetDescription &desc)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

edm::Handle<reco::PFTauDiscriminator> RecoTauMVATransform::disc_
private

Definition at line 62 of file RecoTauMVATransform.cc.

Referenced by beginEvent().

edm::InputTag RecoTauMVATransform::input_
private

Definition at line 61 of file RecoTauMVATransform.cc.

Referenced by beginEvent(), and RecoTauMVATransform().

TransformMap RecoTauMVATransform::transforms_
private

Definition at line 59 of file RecoTauMVATransform.cc.

Referenced by discriminate(), and RecoTauMVATransform().