CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/RecoTauTag/RecoTau/plugins/PFRecoTauDiscriminationAgainstMuon.cc

Go to the documentation of this file.
00001 /* 
00002  * class PFRecoTauDiscriminationAgainstMuon
00003  * created : May 07 2008,
00004  * revised : ,
00005  * Authors : Sho Maruyama
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 
00013 #include "DataFormats/MuonReco/interface/MuonSelectors.h"
00014 
00015 
00016 #include <string>
00017 
00018 using namespace reco;
00019 
00020 class PFRecoTauDiscriminationAgainstMuon : public PFTauDiscriminationProducerBase {
00021    public:
00022       explicit PFRecoTauDiscriminationAgainstMuon(const edm::ParameterSet& iConfig):PFTauDiscriminationProducerBase(iConfig) {   
00023          discriminatorOption_  = iConfig.getParameter<std::string>("discriminatorOption");  
00024          a  = iConfig.getParameter<double>("a");  
00025          b  = iConfig.getParameter<double>("b");  
00026          c  = iConfig.getParameter<double>("c");  
00027       }
00028 
00029       ~PFRecoTauDiscriminationAgainstMuon(){} 
00030 
00031       double discriminate(const PFTauRef& pfTau);
00032 
00033    private:  
00034       std::string discriminatorOption_;
00035       double a;
00036       double b;
00037       double c;
00038 };
00039 
00040 double PFRecoTauDiscriminationAgainstMuon::discriminate(const PFTauRef& thePFTauRef)
00041 {
00042    bool decision = true;
00043 
00044    if((*thePFTauRef).hasMuonReference() ){
00045 
00046       MuonRef muonref = (*thePFTauRef).leadPFChargedHadrCand()->muonRef();
00047       if (discriminatorOption_ == "noSegMatch") {
00048          if ( muonref ->numberOfMatches() > 0 ) {
00049             decision = false;
00050          }
00051       }
00052       else if (discriminatorOption_ == "twoDCut") {
00053          double seg = muon::segmentCompatibility(*muonref);
00054          double calo= muonref->caloCompatibility(); 
00055          double border = calo * a + seg * b +c;
00056          if ( border > 0 ) {
00057             decision = false; 
00058          } 
00059       }
00060       else if (discriminatorOption_ == "merePresence") decision = false;
00061       else if (discriminatorOption_ == "combined") { // testing purpose only
00062          unsigned int muType = 0;
00063          if(muonref->isGlobalMuon()) muType = 1;
00064          else if(muonref->isCaloMuon()) muType = 2;
00065          else if(muonref->isTrackerMuon()) muType = 3;
00066          double muonEnergyFraction = (*thePFTauRef).pfTauTagInfoRef()->pfjetRef()->chargedMuEnergyFraction();
00067          bool eta_veto = false;
00068          bool phi_veto = false;
00069          if(fabs(muonref->eta()) > 2.3 || (fabs(muonref->eta()) > 1.4 && fabs(muonref->eta()) < 1.6)) eta_veto = true;
00070          if(muonref->phi() < 0.1 && muonref->phi() > -0.1) phi_veto = true;
00071          if( muType != 1 || muonref ->numberOfMatches() > 0 || eta_veto || phi_veto || muonEnergyFraction > 0.9 ) decision = false; // as place holder
00072       }
00073       else if (discriminatorOption_ == "noAllArbitrated") { // One used in H->tautau 2010
00074         if(muon::isGoodMuon(*muonref,muon::AllArbitrated))
00075           decision = false;
00076       }
00077       else{
00078          throw edm::Exception(edm::errors::UnimplementedFeature) << " Invalid Discriminator Option! Please check cfi file \n";
00079       }
00080    } // valid muon ref
00081 
00082    return (decision ? 1. : 0.);
00083 } 
00084 
00085 DEFINE_FWK_MODULE(PFRecoTauDiscriminationAgainstMuon );