27 template<
class TauType,
class TauDiscriminator>
36 ~TauDiscriminationAgainstMuon()
override {}
41 double discriminate(
const TauRef&)
const override;
46 bool evaluateMuonVeto(
const reco::Muon&)
const;
52 enum { kNoSegMatch, kTwoDCut, kMerePresence, kCombined };
53 int discriminatorOption_;
55 double coeffCaloComp_;
56 double coeffSegmComp_;
60 template<
class TauType,
class TauDiscriminator>
61 TauDiscriminationAgainstMuon<TauType, TauDiscriminator>::TauDiscriminationAgainstMuon(
const edm::ParameterSet&
cfg)
68 if ( discriminatorOption_string ==
"noSegMatch" ) discriminatorOption_ = kNoSegMatch;
69 else if ( discriminatorOption_string ==
"twoDCut" ) discriminatorOption_ = kTwoDCut;
70 else if ( discriminatorOption_string ==
"merePresence" ) discriminatorOption_ = kMerePresence;
71 else if ( discriminatorOption_string ==
"combined" ) discriminatorOption_ = kCombined;
76 coeffCaloComp_ = cfg.
getParameter<
double>(
"caloCompCoefficient");
77 coeffSegmComp_ = cfg.
getParameter<
double>(
"segmCompCoefficient");
81 template<
class TauType,
class TauDiscriminator>
82 void TauDiscriminationAgainstMuon<TauType, TauDiscriminator>::beginEvent(
const edm::Event& evt,
const edm::EventSetup& evtSetup)
87 template<
class TauType,
class TauDiscriminator>
88 bool TauDiscriminationAgainstMuon<TauType, TauDiscriminator>::evaluateMuonVeto(
const reco::Muon&
muon)
const 92 if ( discriminatorOption_ == kNoSegMatch ) {
94 }
else if ( discriminatorOption_ == kTwoDCut ) {
97 if ( (coeffCaloComp_*segmComp + coeffSegmComp_*caloComp) > muonCompCut_ ) decision =
false;
98 }
else if ( discriminatorOption_ == kMerePresence ) {
100 }
else if ( discriminatorOption_ == kCombined ) {
101 unsigned int muonType = 0;
106 bool eta_veto = ( fabs(muon.
eta()) > 2.3 || (fabs(muon.
eta()) > 1.4 && fabs(muon.
eta()) < 1.6) ) ?
true :
false;
107 bool phi_veto = ( muon.
phi() < 0.1 && muon.
phi() > -0.1 ) ?
true :
false;
109 if ( muonType != 1 || muon.
numberOfMatches() > 0 || eta_veto || phi_veto ) decision =
false;
115 template<
class TauType,
class TauDiscriminator>
116 double TauDiscriminationAgainstMuon<TauType, TauDiscriminator>::discriminate(
const TauRef&
tau)
const 118 bool decision =
true;
120 for ( reco::MuonCollection::const_iterator muon = muons_->
begin();
121 muon != muons_->
end(); ++
muon ) {
122 if (
reco::deltaR(muon->
p4(), tau->p4()) < dRmatch_ ) decision &= evaluateMuonVeto(*muon);
125 return (decision ? 1. : 0.);
129 template<
class TauType,
class TauDiscriminator>
136 desc.
add<
double>(
"muonCompCut", 0.0);
137 desc.add<
double>(
"segmCompCoefficient", 0.5);
138 desc.add<
double>(
"dRmatch", 0.5);
144 psd1.
add<
double>(
"cut");
151 desc.add<
double>(
"caloCompCoefficient", 0.5);
152 descriptions.add(
"caloRecoTauDiscriminationAgainstMuon", desc);
T getParameter(std::string const &) const
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
double eta() const final
momentum pseudorapidity
edm::Ref< TauBxCollection > TauRef
std::vector< Tau > TauCollection
TauDiscriminationAgainstMuon< CaloTau, CaloTauDiscriminator > CaloRecoTauDiscriminationAgainstMuon
bool isTrackerMuon() const override
#define DEFINE_FWK_MODULE(type)
bool isGlobalMuon() const override
const_iterator end() const
last daughter const_iterator
float segmentCompatibility(const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
const LorentzVector & p4() const final
four-momentum Lorentz vector
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
int numberOfMatches(ArbitrationType type=SegmentAndTrackArbitration) const
get number of chambers with matched segments
const_iterator begin() const
first daughter const_iterator
bool isCaloMuon() const override
double phi() const final
momentum azimuthal angle
float caloCompatibility() const