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, TauDiscriminatorDataType, ConsumeType > 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, TauDiscriminatorDataType, ConsumeType >
virtual void beginEvent (const edm::Event &, const edm::EventSetup &)
 
virtual TauDiscriminatorDataType discriminate (const TauRef &tau) const =0
 
virtual void endEvent (edm::Event &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 TauDiscriminationProducerBase ()
 
 TauDiscriminationProducerBase (const edm::ParameterSet &iConfig)
 
 ~TauDiscriminationProducerBase () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from TauDiscriminationProducerBase< TauType, TauDiscriminator, TauDiscriminatorDataType, ConsumeType >
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, TauDiscriminatorDataType, ConsumeType >
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, TauDiscriminatorDataType, ConsumeType >
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::PFRecoTauDiscriminationAgainstMuon ( const edm::ParameterSet iConfig)
inlineexplicit

Definition at line 23 of file PFRecoTauDiscriminationAgainstMuon.cc.

25  discriminatorOption_ = iConfig.getParameter<std::string>("discriminatorOption");
26  hop_ = iConfig.getParameter<double>("HoPMin");
27  a = iConfig.getParameter<double>("a");
28  b = iConfig.getParameter<double>("b");
29  c = iConfig.getParameter<double>("c");
30  maxNumberOfMatches_ = iConfig.getParameter<int>("maxNumberOfMatches");
31  checkNumMatches_ = iConfig.getParameter<bool>("checkNumMatches");
32  }

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

◆ ~PFRecoTauDiscriminationAgainstMuon()

PFRecoTauDiscriminationAgainstMuon::~PFRecoTauDiscriminationAgainstMuon ( )
inlineoverride

Definition at line 34 of file PFRecoTauDiscriminationAgainstMuon.cc.

34 {}

Member Function Documentation

◆ discriminate()

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

Definition at line 50 of file PFRecoTauDiscriminationAgainstMuon.cc.

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

References a, muon::AllArbitrated, b, HltBtagPostValidation_cff::c, L1TowerCalibrationProducer_cfi::calo, 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.

◆ fillDescriptions()

void PFRecoTauDiscriminationAgainstMuon::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 115 of file PFRecoTauDiscriminationAgainstMuon.cc.

115  {
116  // pfRecoTauDiscriminationAgainstMuon
118  desc.add<double>("a", 0.5);
119  desc.add<double>("c", 0.0);
120  desc.add<double>("b", 0.5);
121  desc.add<edm::InputTag>("PFTauProducer", edm::InputTag("pfRecoTauProducer"));
122  {
124  psd0.add<std::string>("BooleanOperator", "and");
125  {
127  psd1.add<double>("cut");
128  psd1.add<edm::InputTag>("Producer");
129  psd0.addOptional<edm::ParameterSetDescription>("leadTrack", psd1);
130  }
131  desc.add<edm::ParameterSetDescription>("Prediscriminants", psd0);
132  }
133  desc.add<std::string>("discriminatorOption", "noSegMatch");
134  desc.add<double>("HoPMin", 0.2);
135  desc.add<int>("maxNumberOfMatches", 0);
136  desc.add<bool>("checkNumMatches", false);
137  descriptions.add("pfRecoTauDiscriminationAgainstMuon", desc);
138 }

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

Member Data Documentation

◆ a

double PFRecoTauDiscriminationAgainstMuon::a
private

Definition at line 43 of file PFRecoTauDiscriminationAgainstMuon.cc.

◆ b

double PFRecoTauDiscriminationAgainstMuon::b
private

Definition at line 44 of file PFRecoTauDiscriminationAgainstMuon.cc.

◆ c

double PFRecoTauDiscriminationAgainstMuon::c
private

Definition at line 45 of file PFRecoTauDiscriminationAgainstMuon.cc.

◆ checkNumMatches_

bool PFRecoTauDiscriminationAgainstMuon::checkNumMatches_
private

Definition at line 47 of file PFRecoTauDiscriminationAgainstMuon.cc.

◆ discriminatorOption_

std::string PFRecoTauDiscriminationAgainstMuon::discriminatorOption_
private

Definition at line 41 of file PFRecoTauDiscriminationAgainstMuon.cc.

◆ hop_

double PFRecoTauDiscriminationAgainstMuon::hop_
private

Definition at line 42 of file PFRecoTauDiscriminationAgainstMuon.cc.

◆ maxNumberOfMatches_

int PFRecoTauDiscriminationAgainstMuon::maxNumberOfMatches_
private

Definition at line 46 of file PFRecoTauDiscriminationAgainstMuon.cc.

edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
PFRecoTauDiscriminationAgainstMuon::checkNumMatches_
bool checkNumMatches_
Definition: PFRecoTauDiscriminationAgainstMuon.cc:47
L1TowerCalibrationProducer_cfi.calo
calo
Definition: L1TowerCalibrationProducer_cfi.py:59
muon::segmentCompatibility
float segmentCompatibility(const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
Definition: MuonSelectors.cc:61
reco::btau::muonEnergyFraction
Definition: TaggingVariable.h:107
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
PFRecoTauDiscriminationAgainstMuon::hop_
double hop_
Definition: PFRecoTauDiscriminationAgainstMuon.cc:42
PFTauDiscriminationProducerBase
TauDiscriminationProducerBase< reco::PFTau, reco::PFTauDiscriminator > PFTauDiscriminationProducerBase
Definition: TauDiscriminationProducerBase.h:124
edm::ParameterSetDescription::addOptional
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:105
PFRecoTauDiscriminationAgainstMuon::discriminatorOption_
std::string discriminatorOption_
Definition: PFRecoTauDiscriminationAgainstMuon.cc:41
edm::Ref< MuonCollection >
muon::isGoodMuon
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
Definition: MuonSelectors.cc:664
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
PFRecoTauDiscriminationAgainstMuon::maxNumberOfMatches_
int maxNumberOfMatches_
Definition: PFRecoTauDiscriminationAgainstMuon.cc:46
PFRecoTauDiscriminationAgainstMuon::c
double c
Definition: PFRecoTauDiscriminationAgainstMuon.cc:45
reco::PFJet::chargedMuEnergyFraction
float chargedMuEnergyFraction() const
chargedMuEnergyFraction
Definition: PFJet.h:145
muon::AllArbitrated
Definition: MuonSelectors.h:25
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Exception
Definition: hltDiff.cc:246
PFRecoTauDiscriminationAgainstMuon::b
double b
Definition: PFRecoTauDiscriminationAgainstMuon.cc:44
reco::PFJet
Jets made from PFObjects.
Definition: PFJet.h:20
PFRecoTauDiscriminationAgainstMuon::a
double a
Definition: PFRecoTauDiscriminationAgainstMuon.cc:43
edm::InputTag
Definition: InputTag.h:15
edm::errors::UnimplementedFeature
Definition: EDMException.h:38