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 
9 
12 
14 
15 
16 #include <string>
17 
18 using namespace reco;
19 
21 {
22  public:
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  }
34 
36 
37  double discriminate(const PFTauRef& pfTau) const override;
38 
39  private:
41  double hop_;
42  double a;
43  double b;
44  double c;
47 };
48 
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 }
97 
T getParameter(std::string const &) const
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:251
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
bool exists(std::string const &parameterName) const
checks if a parameter exists
double discriminate(const PFTauRef &pfTau) const override
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
double b
Definition: hdecay.h:120
PFRecoTauDiscriminationAgainstMuon(const edm::ParameterSet &iConfig)
fixed size matrix
double a
Definition: hdecay.h:121