CMS 3D CMS Logo

List of all members | 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
 

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 45 of file RecoTauMVATransform.cc.

Member Typedef Documentation

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

Definition at line 55 of file RecoTauMVATransform.cc.

Constructor & Destructor Documentation

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

Definition at line 63 of file RecoTauMVATransform.cc.

References taus_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().

65  input_ = pset.getParameter<edm::InputTag>("toTransform");
66  typedef std::vector<edm::ParameterSet> VPSet;
67  const VPSet& transforms = pset.getParameter<VPSet>("transforms");
69  BOOST_FOREACH(const edm::ParameterSet &transform, transforms) {
70  unsigned int nCharged = transform.getParameter<unsigned int>("nCharged");
71  unsigned int nPiZeros = transform.getParameter<unsigned int>("nPiZeros");
72  // Get the transform
73  const edm::ParameterSet &transformImpl =
74  transform.getParameter<edm::ParameterSet>("transform");
75  // Get the acutal decay mode
77  reco::tau::translateDecayMode(nCharged, nPiZeros);
78 
79  if (!transforms_.count(decayMode)) {
80  // Add it
81  transforms_.insert(decayMode, buildTransform(transformImpl));
82  } else {
83  edm::LogError("DecayModeNotUnique") << "The tau decay mode with "
84  "nCharged/nPiZero = " << nCharged << "/" << nPiZeros <<
85  " dm: " << decayMode <<
86  " is associated to multiple MVA transforms, "
87  "the second instantiation is being ignored!!!";
88  }
89  }
90 }
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 48 of file RecoTauMVATransform.cc.

References beginEvent(), and discriminate().

48 {}

Member Function Documentation

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

Reimplemented from TauDiscriminationProducerBase< TauType, TauDiscriminator >.

Definition at line 94 of file RecoTauMVATransform.cc.

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

Referenced by ~RecoTauMVATransform().

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

Definition at line 98 of file RecoTauMVATransform.cc.

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

Referenced by ~RecoTauMVATransform().

98  {
99  // Check if we support this decay mode:
100  TransformMap::const_iterator transformIter =
101  transforms_.find(tau->decayMode());
102  // Unsupported DM
103  if (transformIter == transforms_.end())
105  const TGraph *transform = transformIter->second;
106  // Get the discriminator output to transform
107  double value = (*disc_)[tau];
108  double result = transform->Eval(value);
109  return result;
110 }
Definition: value.py:1

Member Data Documentation

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

Definition at line 59 of file RecoTauMVATransform.cc.

Referenced by beginEvent().

edm::InputTag RecoTauMVATransform::input_
private

Definition at line 58 of file RecoTauMVATransform.cc.

Referenced by beginEvent(), and RecoTauMVATransform().

TransformMap RecoTauMVATransform::transforms_
private

Definition at line 56 of file RecoTauMVATransform.cc.

Referenced by discriminate(), and RecoTauMVATransform().