CMS 3D CMS Logo

List of all members | Public Member Functions | Static 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
 

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 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
 
- 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 21 of file PFRecoTauDiscriminationAgainstMuon.cc.

Constructor & Destructor Documentation

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

Definition at line 24 of file PFRecoTauDiscriminationAgainstMuon.cc.

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

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

Definition at line 36 of file PFRecoTauDiscriminationAgainstMuon.cc.

References fillDescriptions().

36 {}

Member Function Documentation

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

Definition at line 52 of file PFRecoTauDiscriminationAgainstMuon.cc.

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

53 {
54  bool decision = true;
55 
56  if ( thePFTauRef->hasMuonReference() ) {
57 
58  MuonRef muonref = thePFTauRef->leadPFChargedHadrCand()->muonRef();
59  if ( discriminatorOption_ == "noSegMatch" ) {
60  if ( muonref ->numberOfMatches() > maxNumberOfMatches_ ) decision = false;
61  } else if (discriminatorOption_ == "twoDCut") {
62  double seg = muon::segmentCompatibility(*muonref);
63  double calo= muonref->caloCompatibility();
64  double border = calo * a + seg * b +c;
65  if ( border > 0 ) decision = false;
66  } else if ( discriminatorOption_ == "merePresence" ) {
67  decision = false;
68  } else if (discriminatorOption_ == "combined" ) { // testing purpose only
69  unsigned int muType = 0;
70  if ( muonref->isGlobalMuon() ) muType = 1;
71  else if ( muonref->isCaloMuon() ) muType = 2;
72  else if ( muonref->isTrackerMuon() ) muType = 3;
73  float muonEnergyFraction = 0.;
74  const reco::PFJet* pfJetPtr = dynamic_cast<const reco::PFJet*>(thePFTauRef->pfTauTagInfoRef()->pfjetRef().get());
75  if (pfJetPtr) {
76  muonEnergyFraction = pfJetPtr->chargedMuEnergyFraction();
77  } else throw cms::Exception("Type Mismatch") << "The PFTau was not made from PFJets, and this outdated algorithm was not updated to cope with PFTaus made from other Jets.\n";
78  bool eta_veto = false;
79  bool phi_veto = false;
80  if ( fabs(muonref->eta()) > 2.3 || (fabs(muonref->eta()) > 1.4 && fabs(muonref->eta()) < 1.6)) eta_veto = true;
81  if ( muonref->phi() < 0.1 && muonref->phi() > -0.1) phi_veto = true;
82  if ( muType != 1 || muonref ->numberOfMatches() > 0 || eta_veto || phi_veto || muonEnergyFraction > 0.9 ) decision = false; // as place holder
83  } else if ( discriminatorOption_ == "noAllArbitrated" || discriminatorOption_ == "noAllArbitratedWithHOP" ) {
84  if(checkNumMatches_ && muonref ->numberOfMatches() > maxNumberOfMatches_) decision = false;
85  if ( muon::isGoodMuon(*muonref, muon::AllArbitrated) ) decision = false;
86  } else if ( discriminatorOption_ == "HOP" ) {
87  decision = true; // only calo. muon cut requested: keep all tau candidates, regardless of signals in muon system
88  } else {
90  << " Invalid Discriminator option = " << discriminatorOption_ << " --> please check cfi file !!\n";
91  }
92  } // valid muon ref
93 
94  // Additional calo. muon cut: veto one prongs compatible with MIP signature
95  if ( discriminatorOption_ == "HOP" || discriminatorOption_ == "noAllArbitratedWithHOP" ) {
96  if ( thePFTauRef->leadPFChargedHadrCand().isNonnull() ) {
97  double muonCaloEn = thePFTauRef->leadPFChargedHadrCand()->hcalEnergy() + thePFTauRef->leadPFChargedHadrCand()->ecalEnergy();
98  if ( thePFTauRef->decayMode() == 0 && muonCaloEn < (hop_*thePFTauRef->leadPFChargedHadrCand()->p()) ) decision = false;
99  }
100  }
101 
102  return (decision ? 1. : 0.);
103 }
Jets made from PFObjects.
Definition: PFJet.h:21
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
float chargedMuEnergyFraction() const
chargedMuEnergyFraction
Definition: PFJet.h:148
void PFRecoTauDiscriminationAgainstMuon::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 106 of file PFRecoTauDiscriminationAgainstMuon.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addOptional(), DEFINE_FWK_MODULE, and AlCaHLTBitMon_QueryRunRegistry::string.

106  {
107  // pfRecoTauDiscriminationAgainstMuon
109  desc.add<double>("a", 0.5);
110  desc.add<double>("c", 0.0);
111  desc.add<double>("b", 0.5);
112  desc.add<edm::InputTag>("PFTauProducer", edm::InputTag("pfRecoTauProducer"));
113  {
115  psd0.add<std::string>("BooleanOperator", "and");
116  {
118  psd1.add<double>("cut");
119  psd1.add<edm::InputTag>("Producer");
120  psd0.addOptional<edm::ParameterSetDescription>("leadTrack", psd1);
121  }
122  desc.add<edm::ParameterSetDescription>("Prediscriminants", psd0);
123  }
124  desc.add<std::string>("discriminatorOption", "noSegMatch");
125  desc.add<double>("HoPMin", 0.2);
126  desc.add<int>("maxNumberOfMatches", 0);
127  desc.add<bool>("checkNumMatches", false);
128  descriptions.add("pfRecoTauDiscriminationAgainstMuon", desc);
129 }
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

Member Data Documentation

double PFRecoTauDiscriminationAgainstMuon::a
private

Definition at line 45 of file PFRecoTauDiscriminationAgainstMuon.cc.

double PFRecoTauDiscriminationAgainstMuon::b
private

Definition at line 46 of file PFRecoTauDiscriminationAgainstMuon.cc.

double PFRecoTauDiscriminationAgainstMuon::c
private

Definition at line 47 of file PFRecoTauDiscriminationAgainstMuon.cc.

bool PFRecoTauDiscriminationAgainstMuon::checkNumMatches_
private

Definition at line 49 of file PFRecoTauDiscriminationAgainstMuon.cc.

std::string PFRecoTauDiscriminationAgainstMuon::discriminatorOption_
private

Definition at line 43 of file PFRecoTauDiscriminationAgainstMuon.cc.

double PFRecoTauDiscriminationAgainstMuon::hop_
private

Definition at line 44 of file PFRecoTauDiscriminationAgainstMuon.cc.

int PFRecoTauDiscriminationAgainstMuon::maxNumberOfMatches_
private

Definition at line 48 of file PFRecoTauDiscriminationAgainstMuon.cc.