CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
PFRecoTauDiscriminationAgainstMuon Class Reference
Inheritance diagram for PFRecoTauDiscriminationAgainstMuon:
TauDiscriminationProducerBase< TauType, TauDiscriminator > edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

double discriminate (const PFTauRef &pfTau) const override
 
 PFRecoTauDiscriminationAgainstMuon (const edm::ParameterSet &iConfig)
 
 ~PFRecoTauDiscriminationAgainstMuon ()
 
- Public Member Functions inherited from TauDiscriminationProducerBase< TauType, TauDiscriminator >
virtual void beginEvent (const edm::Event &evt, const edm::EventSetup &evtSetup)
 
virtual double discriminate (const TauRef &tau) const =0
 
virtual void endEvent (edm::Event &evt)
 
void produce (edm::Event &, const edm::EventSetup &)
 
 TauDiscriminationProducerBase (const edm::ParameterSet &iConfig)
 
 TauDiscriminationProducerBase ()
 
virtual ~TauDiscriminationProducerBase ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

double a
 
double b
 
double c
 
bool checkNumMatches_
 
std::string discriminatorOption_
 
double hop_
 
int maxNumberOfMatches_
 

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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase 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::stream::EDProducerBase
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)
 
- 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 20 of file PFRecoTauDiscriminationAgainstMuon.cc.

Constructor & Destructor Documentation

PFRecoTauDiscriminationAgainstMuon::PFRecoTauDiscriminationAgainstMuon ( const edm::ParameterSet iConfig)
inlineexplicit

Definition at line 23 of file PFRecoTauDiscriminationAgainstMuon.cc.

References a, b, EnergyCorrector::c, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

25  {
26  discriminatorOption_ = iConfig.getParameter<std::string>("discriminatorOption");
27  hop_ = iConfig.getParameter<double>("HoPMin");
28  a = iConfig.getParameter<double>("a");
29  b = iConfig.getParameter<double>("b");
30  c = iConfig.getParameter<double>("c");
31  maxNumberOfMatches_ = iConfig.exists("maxNumberOfMatches") ? iConfig.getParameter<int>("maxNumberOfMatches") : 0;
32  checkNumMatches_ = iConfig.exists("checkNumMatches") ? iConfig.getParameter<bool>("checkNumMatches") : false;
33  }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
TauDiscriminationProducerBase< reco::PFTau, reco::PFTauDiscriminator > PFTauDiscriminationProducerBase
PFRecoTauDiscriminationAgainstMuon::~PFRecoTauDiscriminationAgainstMuon ( )
inline

Definition at line 35 of file PFRecoTauDiscriminationAgainstMuon.cc.

35 {}

Member Function Documentation

double PFRecoTauDiscriminationAgainstMuon::discriminate ( const PFTauRef pfTau) const
override

Definition at line 49 of file PFRecoTauDiscriminationAgainstMuon.cc.

References a, muon::AllArbitrated, b, EnergyCorrector::c, DEFINE_FWK_MODULE, Exception, muon::isGoodMuon(), edm::Ref< C, T, F >::isNonnull(), reco::btau::muonEnergyFraction, muon::segmentCompatibility(), and edm::errors::UnimplementedFeature.

50 {
51  bool decision = true;
52 
53  if ( thePFTauRef->hasMuonReference() ) {
54 
55  MuonRef muonref = thePFTauRef->leadPFChargedHadrCand()->muonRef();
56  if ( discriminatorOption_ == "noSegMatch" ) {
57  if ( muonref ->numberOfMatches() > maxNumberOfMatches_ ) decision = false;
58  } else if (discriminatorOption_ == "twoDCut") {
59  double seg = muon::segmentCompatibility(*muonref);
60  double calo= muonref->caloCompatibility();
61  double border = calo * a + seg * b +c;
62  if ( border > 0 ) decision = false;
63  } else if ( discriminatorOption_ == "merePresence" ) {
64  decision = false;
65  } else if (discriminatorOption_ == "combined" ) { // testing purpose only
66  unsigned int muType = 0;
67  if ( muonref->isGlobalMuon() ) muType = 1;
68  else if ( muonref->isCaloMuon() ) muType = 2;
69  else if ( muonref->isTrackerMuon() ) muType = 3;
70  double muonEnergyFraction = thePFTauRef->pfTauTagInfoRef()->pfjetRef()->chargedMuEnergyFraction();
71  bool eta_veto = false;
72  bool phi_veto = false;
73  if ( fabs(muonref->eta()) > 2.3 || (fabs(muonref->eta()) > 1.4 && fabs(muonref->eta()) < 1.6)) eta_veto = true;
74  if ( muonref->phi() < 0.1 && muonref->phi() > -0.1) phi_veto = true;
75  if ( muType != 1 || muonref ->numberOfMatches() > 0 || eta_veto || phi_veto || muonEnergyFraction > 0.9 ) decision = false; // as place holder
76  } else if ( discriminatorOption_ == "noAllArbitrated" || discriminatorOption_ == "noAllArbitratedWithHOP" ) {
77  if(checkNumMatches_ && muonref ->numberOfMatches() > maxNumberOfMatches_) decision = false;
78  if ( muon::isGoodMuon(*muonref, muon::AllArbitrated) ) decision = false;
79  } else if ( discriminatorOption_ == "HOP" ) {
80  decision = true; // only calo. muon cut requested: keep all tau candidates, regardless of signals in muon system
81  } else {
83  << " Invalid Discriminator option = " << discriminatorOption_ << " --> please check cfi file !!\n";
84  }
85  } // valid muon ref
86 
87  // Additional calo. muon cut: veto one prongs compatible with MIP signature
88  if ( discriminatorOption_ == "HOP" || discriminatorOption_ == "noAllArbitratedWithHOP" ) {
89  if ( thePFTauRef->leadPFChargedHadrCand().isNonnull() ) {
90  double muonCaloEn = thePFTauRef->leadPFChargedHadrCand()->hcalEnergy() + thePFTauRef->leadPFChargedHadrCand()->ecalEnergy();
91  if ( thePFTauRef->decayMode() == 0 && muonCaloEn < (hop_*thePFTauRef->leadPFChargedHadrCand()->p()) ) decision = false;
92  }
93  }
94 
95  return (decision ? 1. : 0.);
96 }
float segmentCompatibility(const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call

Member Data Documentation

double PFRecoTauDiscriminationAgainstMuon::a
private

Definition at line 42 of file PFRecoTauDiscriminationAgainstMuon.cc.

double PFRecoTauDiscriminationAgainstMuon::b
private

Definition at line 43 of file PFRecoTauDiscriminationAgainstMuon.cc.

double PFRecoTauDiscriminationAgainstMuon::c
private

Definition at line 44 of file PFRecoTauDiscriminationAgainstMuon.cc.

bool PFRecoTauDiscriminationAgainstMuon::checkNumMatches_
private

Definition at line 46 of file PFRecoTauDiscriminationAgainstMuon.cc.

std::string PFRecoTauDiscriminationAgainstMuon::discriminatorOption_
private

Definition at line 40 of file PFRecoTauDiscriminationAgainstMuon.cc.

double PFRecoTauDiscriminationAgainstMuon::hop_
private

Definition at line 41 of file PFRecoTauDiscriminationAgainstMuon.cc.

int PFRecoTauDiscriminationAgainstMuon::maxNumberOfMatches_
private

Definition at line 45 of file PFRecoTauDiscriminationAgainstMuon.cc.