CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/RecoTauTag/RecoTau/plugins/PFRecoTauDiscriminationAgainstMuon.cc

Go to the documentation of this file.
00001 /* 
00002  * class PFRecoTauDiscriminationAgainstMuon
00003  * created : May 07 2008,
00004  * revised : always,
00005  * Authors : Sho Maruyama,M.Bachtis
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          hop_  = iConfig.getParameter<double>("HoPMin");  
00025          a  = iConfig.getParameter<double>("a");  
00026          b  = iConfig.getParameter<double>("b");  
00027          c  = iConfig.getParameter<double>("c");  
00028          
00029       }
00030 
00031       ~PFRecoTauDiscriminationAgainstMuon(){} 
00032 
00033       double discriminate(const PFTauRef& pfTau);
00034 
00035    private:  
00036       std::string discriminatorOption_;
00037       double hop_;
00038       double a;
00039       double b;
00040       double c;
00041 };
00042 
00043 double PFRecoTauDiscriminationAgainstMuon::discriminate(const PFTauRef& thePFTauRef)
00044 {
00045    bool decision = true;
00046 
00047    if((*thePFTauRef).hasMuonReference() ){
00048 
00049       MuonRef muonref = (*thePFTauRef).leadPFChargedHadrCand()->muonRef();
00050       if (discriminatorOption_ == "noSegMatch") {
00051          if ( muonref ->numberOfMatches() > 0 ) {
00052             decision = false;
00053          }
00054       }
00055       else if (discriminatorOption_ == "twoDCut") {
00056          double seg = muon::segmentCompatibility(*muonref);
00057          double calo= muonref->caloCompatibility(); 
00058          double border = calo * a + seg * b +c;
00059          if ( border > 0 ) {
00060             decision = false; 
00061          } 
00062       }
00063       else if (discriminatorOption_ == "merePresence") decision = false;
00064       else if (discriminatorOption_ == "combined") { // testing purpose only
00065          unsigned int muType = 0;
00066          if(muonref->isGlobalMuon()) muType = 1;
00067          else if(muonref->isCaloMuon()) muType = 2;
00068          else if(muonref->isTrackerMuon()) muType = 3;
00069          double muonEnergyFraction = (*thePFTauRef).pfTauTagInfoRef()->pfjetRef()->chargedMuEnergyFraction();
00070          bool eta_veto = false;
00071          bool phi_veto = false;
00072          if(fabs(muonref->eta()) > 2.3 || (fabs(muonref->eta()) > 1.4 && fabs(muonref->eta()) < 1.6)) eta_veto = true;
00073          if(muonref->phi() < 0.1 && muonref->phi() > -0.1) phi_veto = true;
00074          if( muType != 1 || muonref ->numberOfMatches() > 0 || eta_veto || phi_veto || muonEnergyFraction > 0.9 ) decision = false; // as place holder
00075       }
00076       else if (discriminatorOption_ == "noAllArbitrated" ||discriminatorOption_ == "noAllArbitratedWithHOP" ) { // One used in H->tautau 2010
00077         if(muon::isGoodMuon(*muonref,muon::AllArbitrated))
00078           decision = false;
00079       }
00080       else{
00081          throw edm::Exception(edm::errors::UnimplementedFeature) << " Invalid Discriminator Option! Please check cfi file \n";
00082       }
00083    } // valid muon ref
00084 
00085 
00086    //Additional : Apply HOP cut for one prongs only
00087    if((*thePFTauRef).leadPFChargedHadrCand().isNonnull() && discriminatorOption_ == "noAllArbitratedWithHOP" ) {
00088      if(thePFTauRef->decayMode()==0 && ((*thePFTauRef).leadPFChargedHadrCand()->hcalEnergy()+(*thePFTauRef).leadPFChargedHadrCand()->ecalEnergy())/(*thePFTauRef).leadPFChargedHadrCand()->p()<hop_)
00089        decision=false;
00090    }
00091 
00092 
00093 
00094 
00095    return (decision ? 1. : 0.);
00096 } 
00097 
00098 DEFINE_FWK_MODULE(PFRecoTauDiscriminationAgainstMuon );