ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Utils/src/MetLeptonTools.cc
(Generate patch)

Comparing UserCode/MitPhysics/Utils/src/MetLeptonTools.cc (file contents):
Revision 1.1 by pharris, Thu Aug 9 13:15:43 2012 UTC vs.
Revision 1.5 by pharris, Thu Mar 21 17:50:13 2013 UTC

# Line 1 | Line 1
1   #include "MitPhysics/Utils/interface/MetLeptonTools.h"
2   #include <algorithm>
3   #include <vector>
4 + #include "TString.h"
5  
6   using namespace mithep;
7  
8   ClassImp(mithep::MetLeptonTools)
9  
10 < bool MetLeptonTools::looseTauId(const PFTau *iTau) {
11 <  if(iTau->Pt() < 19)                                  return false;
12 <  if(fabs(iTau->Eta()) > fabs(2.3) )                   return false;
13 <  if(!iTau->DiscriminationByDecayModeFinding())        return false;
14 <  if(!iTau->DiscriminationByLooseElectronRejection())  return false;
15 <  if(!iTau->DiscriminationByLooseMuonRejection())      return false;
16 <  if(!iTau->DiscriminationByVLooseIsolation()   )      return false;
10 > MetLeptonTools::MetLeptonTools() {
11 >  //fTauIsoMVA = new TauIsoMVA();
12 >  //fTauIsoMVA->Initialize(TString(getenv("CMSSW_BASE")+std::string("/src/MitPhysics/data/SXIsoMVA_BDTG.weights.xml")));
13 >  fTauIsoMVA = new TauIsoMVA();
14 >  fTauIsoMVA->InitializeGBR(TString(getenv("CMSSW_BASE")+std::string("/src/MitPhysics/data/gbrfTauIso_v2.root")));
15 > }
16 >
17 > bool MetLeptonTools::looseTauId(const PFTau *iTau,const PileupEnergyDensityCol* iPUEnergyDensity) {
18 >  if(iTau->Pt() < 19)                                                 return false;
19 >  if(fabs(iTau->Eta()) > fabs(2.3) )                                  return false;
20 >  if(!iTau->DiscriminationByDecayModeFinding())                       return false;
21 >  if(!iTau->DiscriminationByLooseElectronRejection())                 return false;
22 >  if(!iTau->LooseMuonRejection2())                                    return false;
23 >  //if(!iTau->DiscriminationByVLooseIsolation()   )                   return false;
24 >  if(fTauIsoMVA->MVAValue(iTau,iPUEnergyDensity->At(0)->Rho()) < 0.8) return false;
25    return true;
26   }
27   bool MetLeptonTools::looseEleId(const Electron *iElectron,const PileupEnergyDensityCol* iPUEnergyDensity,
28                                  const PFCandidateCol *iCands,const Vertex *iPV,const VertexCol *iVertices) {
29 +  if(iElectron->SCluster()  == 0)    return false;  
30    if(iElectron->Pt()         < 9.5)  return false;
31    if(fabs(iElectron->Eta())  > 2.5)  return false;
32    if(fabs(iElectron->Eta()) > 1.4442 && fabs(iElectron->Eta()) < 1.566) return false;
33    //if(!fEleTools->PassSpikeRemovalFilter(iElectron)) return false;
34 <  //if(isConversion(iElectron))       return false;                                                                                                                                        
35 <  //if(iElectron->BestTrk()->D0Corrected(*iPV)     > 0.04 )    return false;                                                                                                              
36 <  //if(iElectron->BestTrk()->DzCorrected(*iPV)     > 0.2  )    return false;                                                                                                                
37 <  //if(!passEleMVA(iElectron ,iPUEnergyDensity,iCands,iPV)                             )    return false;                                                                                    
38 <  //if(isoDeltaBeta(iElectron,                 iCands,iPV,iVertices) > 0.30)    return false;                                                                                                
34 >  //if(isConversion(iElectron))       return false;                                                                                                                        
35 >  //if(iElectron->BestTrk()->D0Corrected(*iPV)     > 0.04 )    return false;                                                                                                
36 >  //if(iElectron->BestTrk()->DzCorrected(*iPV)     > 0.2  )    return false;                                                                                              
37 >  //if(!passEleMVA(iElectron ,iPUEnergyDensity,iCands,iPV)                             )    return false;                                                                  
38 >  //if(isoDeltaBeta(iElectron,                 iCands,iPV,iVertices) > 0.30)    return false;                                                                          
39    //return true;                                                                                                                                                                                    
40    
41    if(iElectron->GsfTrk() == 0) return false;
# Line 45 | Line 55 | bool MetLeptonTools::looseEleId(const El
55      double lP = iElectron->P();
56      if(fabs(1./lE-1./lP)                                 > 0.05 )    return false;
57    } else {
58 <    if(fabs(iElectron->DeltaEtaSuperClusterTrackAtVtx()) > 0.007)   return false;
59 <    if(fabs(iElectron->DeltaPhiSuperClusterTrackAtVtx()) > 0.03)    return false;
58 >    if(fabs(iElectron->DeltaEtaSuperClusterTrackAtVtx()) > 0.009)   return false;
59 >    if(fabs(iElectron->DeltaPhiSuperClusterTrackAtVtx()) > 0.10)    return false;
60      if(iElectron->CoviEtaiEta()                          > 0.03)    return false;
61      if(iElectron->HadronicOverEm()                       > 0.10)    return false;
62      double lE = iElectron->SCluster()->Energy();
# Line 67 | Line 77 | bool MetLeptonTools::looseMuId(const Muo
77    if(iMu->TrackerTrk()->NHits()                 < 6  )          return false;
78    if(iMu->NValidHits()                          < 1  )          return false;
79    if(iMu->NMatches()                            < 1  )          return false;
80 <  //if(PFIsolation(iMu,iCands)                    > 0.2)          return false;
80 >  if(PFIsolation(iMu,iCands)                    > 0.3)          return false;
81    //if(isoPV(iMu,iCands,iPV,iVertices)/iMu->Pt()   > 0.2)          return false;
82 <  if(iMu->IsoR03SumPt()/iMu->Pt()                > 0.2)         return false;
82 >  //if(iMu->IsoR03SumPt()/iMu->Pt()                > 0.2)         return false;
83 >  return true;
84 > }
85 > bool MetLeptonTools::loosePhotonId(const Photon *iPhoton) {
86 >  if(iPhoton->Pt()        <   20)                                   return false;
87 >  if(fabs(iPhoton->Eta()) > 1.45)                                   return false;
88 >  if(iPhoton->HadOverEm() > 0.05)                                   return false;
89 >  if(iPhoton->CoviEtaiEta() > 0.01)                                 return false;
90 >  if(iPhoton->HollowConeTrkIsoDr04()    > (2.+0.002*iPhoton->Pt())) return false;
91    return true;
92   }
93   double MetLeptonTools::vis(const PFTau *iTau) {
# Line 86 | Line 104 | Float_t MetLeptonTools::PFIsolation(cons
104    Double_t lPtSum = 0.;
105    for(UInt_t i0 = 0; i0 < iCands->GetEntries(); i0++) {
106      const PFCandidate *pCand = iCands->At(i0);
107 <    if(pCand->PFType() != PFCandidate::eHadron) continue;
108 <    Double_t pDR = MathUtils::DeltaR(iLep->Mom(), pCand->Mom());
109 <    if(pCand->Pt() < 0.5) continue;
110 <    if(pDR         < 0.015 && fabs(iLep->Eta()) > 1.56)   continue;
111 <    if(pDR         > 0.3)                                 continue;
107 >     Double_t pDR = MathUtils::DeltaR(iLep->Mom(), pCand->Mom());
108 >     if(pDR < 0.0001) continue;
109 >     if(pDR < 0.01 && (pCand->PFType() != PFCandidate::eNeutralHadron || pCand->PFType() != PFCandidate::eGamma)) continue;
110 >     if(pCand->Pt() < 0.5 && (pCand->PFType() != PFCandidate::eNeutralHadron || pCand->PFType() != PFCandidate::eGamma)) continue;
111 >     if(pCand->PFType() != PFCandidate::eNeutralHadron && pCand->PFType() != PFCandidate::eGamma && pCand->PFType() != PFCandidate::eHadron ) continue;
112 >     //if(pCand->PFType() != PFCandidate::eHadron) continue;
113 >     //if(pCand->Pt() < 0.5) continue;
114 >     //if(pDR         < 0.0001 && fabs(iLep->Eta()) > 1.56)   continue;
115 >     if(pDR         > 0.3)                                 continue;
116      lPtSum += pCand->Pt();
117    }
118 <  return lPtSum;
118 >  return lPtSum/iLep->Pt();
119   }
120   Float_t MetLeptonTools::isoPV(const ChargedParticle *iLep,const PFCandidateCol *iCands,
121                                const Vertex *iPV,const VertexCol *iVertices,bool iEle) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines