CMS 3D CMS Logo

PFRecoTauDiscriminationAgainstMuon.cc
Go to the documentation of this file.
1 /*
2  * class PFRecoTauDiscriminationAgainstMuon
3  * created : May 07 2008,
4  * revised : always,
5  * Authors : Sho Maruyama,M.Bachtis
6  */
7 
10 
12 
16 
17 #include <string>
18 
19 using namespace reco;
20 
22 public:
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  }
33 
35 
36  double discriminate(const PFTauRef& pfTau) const override;
37 
38  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
39 
40 private:
42  double hop_;
43  double a;
44  double b;
45  double c;
48 };
49 
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 }
114 
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 }
139 
ConfigurationDescriptions.h
PFRecoTauDiscriminationAgainstMuon::~PFRecoTauDiscriminationAgainstMuon
~PFRecoTauDiscriminationAgainstMuon() override
Definition: PFRecoTauDiscriminationAgainstMuon.cc:34
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
TauDiscriminationProducerBase.h
PFRecoTauDiscriminationAgainstMuon::checkNumMatches_
bool checkNumMatches_
Definition: PFRecoTauDiscriminationAgainstMuon.cc:47
L1TowerCalibrationProducer_cfi.calo
calo
Definition: L1TowerCalibrationProducer_cfi.py:59
PFRecoTauDiscriminationAgainstMuon::discriminate
double discriminate(const PFTauRef &pfTau) const override
Definition: PFRecoTauDiscriminationAgainstMuon.cc:50
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
PFJet.h
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
PFRecoTauDiscriminationAgainstMuon::hop_
double hop_
Definition: PFRecoTauDiscriminationAgainstMuon.cc:42
edm::Ref::get
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::ParameterSetDescription::addOptional
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:105
PFRecoTauDiscriminationAgainstMuon::PFRecoTauDiscriminationAgainstMuon
PFRecoTauDiscriminationAgainstMuon(const edm::ParameterSet &iConfig)
Definition: PFRecoTauDiscriminationAgainstMuon.cc:23
PFRecoTauDiscriminationAgainstMuon::discriminatorOption_
std::string discriminatorOption_
Definition: PFRecoTauDiscriminationAgainstMuon.cc:41
edm::Ref< PFTauCollection >
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
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
MuonSelectors.h
MuonFwd.h
fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
TauDiscriminationProducerBase
Definition: TauDiscriminationProducerBase.h:55
ParameterSetDescription.h
b
double b
Definition: hdecay.h:118
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
a
double a
Definition: hdecay.h:119
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
PFRecoTauDiscriminationAgainstMuon::maxNumberOfMatches_
int maxNumberOfMatches_
Definition: PFRecoTauDiscriminationAgainstMuon.cc:46
PFRecoTauDiscriminationAgainstMuon
Definition: PFRecoTauDiscriminationAgainstMuon.cc:21
PFRecoTauDiscriminationAgainstMuon::c
double c
Definition: PFRecoTauDiscriminationAgainstMuon.cc:45
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
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::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: PFRecoTauDiscriminationAgainstMuon.cc:115
PFRecoTauDiscriminationAgainstMuon::a
double a
Definition: PFRecoTauDiscriminationAgainstMuon.cc:43
edm::InputTag
Definition: InputTag.h:15
edm::errors::UnimplementedFeature
Definition: EDMException.h:38