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<>

Public Member Functions

double discriminate (const PFTauRef &pfTau) const override
 
 PFRecoTauDiscriminationAgainstMuon (const edm::ParameterSet &iConfig)
 
 ~PFRecoTauDiscriminationAgainstMuon () override
 
- Public Member Functions inherited from TauDiscriminationProducerBase< TauType, TauDiscriminator >
virtual void beginEvent (const edm::Event &, const edm::EventSetup &)
 
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 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
 
- Static Public Member Functions inherited from TauDiscriminationProducerBase< TauType, TauDiscriminator >
static std::string getTauTypeString ()
 helper method to retrieve tau type name, e.g. to build correct cfi getter More...
 
- 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 ( )
inlineoverride

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.