Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #include "RecoTauTag/RecoTau/interface/TauDiscriminationProducerBase.h"
00009
00010 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00011 #include "DataFormats/MuonReco/interface/MuonSelectors.h"
00012 #include <string>
00013
00014 using namespace reco;
00015
00016 class PFRecoTauDiscriminationAgainstMuon : public PFTauDiscriminationProducerBase {
00017 public:
00018 explicit PFRecoTauDiscriminationAgainstMuon(const edm::ParameterSet& iConfig):PFTauDiscriminationProducerBase(iConfig) {
00019 discriminatorOption_ = iConfig.getParameter<std::string>("discriminatorOption");
00020 a = iConfig.getParameter<double>("a");
00021 b = iConfig.getParameter<double>("b");
00022 c = iConfig.getParameter<double>("c");
00023 }
00024
00025 ~PFRecoTauDiscriminationAgainstMuon(){}
00026
00027 double discriminate(const PFTauRef& pfTau);
00028
00029 private:
00030 std::string discriminatorOption_;
00031 double a;
00032 double b;
00033 double c;
00034 };
00035
00036 double PFRecoTauDiscriminationAgainstMuon::discriminate(const PFTauRef& thePFTauRef)
00037 {
00038 bool decision = true;
00039
00040 if((*thePFTauRef).hasMuonReference() ){
00041
00042 MuonRef muonref = (*thePFTauRef).leadPFChargedHadrCand()->muonRef();
00043 if (discriminatorOption_ == "noSegMatch") {
00044 if ( muonref ->numberOfMatches() > 0 ) {
00045 decision = false;
00046 }
00047 }
00048 else if (discriminatorOption_ == "twoDCut") {
00049 double seg = muon::segmentCompatibility(*muonref);
00050 double calo= muonref->caloCompatibility();
00051 double border = calo * a + seg * b +c;
00052 if ( border > 0 ) {
00053 decision = false;
00054 }
00055 }
00056 else if (discriminatorOption_ == "merePresence") decision = false;
00057 else if (discriminatorOption_ == "combined") {
00058 unsigned int muType = 0;
00059 if(muonref->isGlobalMuon()) muType = 1;
00060 else if(muonref->isCaloMuon()) muType = 2;
00061 else if(muonref->isTrackerMuon()) muType = 3;
00062 double muonEnergyFraction = (*thePFTauRef).pfTauTagInfoRef()->pfjetRef()->chargedMuEnergyFraction();
00063 bool eta_veto = false;
00064 bool phi_veto = false;
00065 if(fabs(muonref->eta()) > 2.3 || (fabs(muonref->eta()) > 1.4 && fabs(muonref->eta()) < 1.6)) eta_veto = true;
00066 if(muonref->phi() < 0.1 && muonref->phi() > -0.1) phi_veto = true;
00067 if( muType != 1 || muonref ->numberOfMatches() > 0 || eta_veto || phi_veto || muonEnergyFraction > 0.9 ) decision = false;
00068 }
00069 else{
00070 throw edm::Exception(edm::errors::UnimplementedFeature) << " Invalid Discriminator Option! Please check cfi file \n";
00071 }
00072 }
00073
00074 return (decision ? 1. : 0.);
00075 }
00076
00077 DEFINE_FWK_MODULE(PFRecoTauDiscriminationAgainstMuon );