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 (const edm::ParameterSet &iConfig)
 
 TauDiscriminationProducerBase ()
 
 ~TauDiscriminationProducerBase () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::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.

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

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  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TauDiscriminationProducerBase< reco::PFTau, reco::PFTauDiscriminator > PFTauDiscriminationProducerBase

◆ ~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.

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

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 }
Jets made from PFObjects.
Definition: PFJet.h:20
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
Definition: Common.h:9
float chargedMuEnergyFraction() const
chargedMuEnergyFraction
Definition: PFJet.h:145

◆ fillDescriptions()

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

Definition at line 115 of file PFRecoTauDiscriminationAgainstMuon.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addOptional(), submitPVResolutionJobs::desc, HLT_2022v12_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

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

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