Skip to content

Commit

Permalink
Using deltaR provided in CMSSW
Browse files Browse the repository at this point in the history
  • Loading branch information
quark2 committed Dec 18, 2018
1 parent 0c74542 commit 0c21443
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions analysis/src/topObjectSelection.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "DataFormats/Math/interface/deltaR.h"
#include "nano/analysis/interface/topObjectSelection.h"

using std::vector;
Expand Down Expand Up @@ -283,7 +284,6 @@ void topObjectSelection::GetJetMassPt(UInt_t nIdx,
if ( nIdxGen >= 0 ) {
fCorrFactor = ( genJetPt + ( fJetPt - genJetPt ) * cJER ) / fJetPt;
} else {
// Different from the postprocess tool, but it might not be important
const double smear = rndEngine->Gaus(0, 1);
fCorrFactor = ( cJER <= 1 ? 1 : 1 + smear * jetRes * sqrt(cJER * cJER - 1) );
}
Expand All @@ -309,17 +309,12 @@ void topObjectSelection::GetJetMassPt(UInt_t nIdx,
Int_t topObjectSelection::GetMatchGenJet(UInt_t nIdxJet, Float_t fResolution) {
UInt_t i;

Float_t dR;
Float_t dRFound = m_fDRcone_JER;
UInt_t nIdxFound = 999;

for ( i = 0 ; i < nGenJet ; i++ ) {
Float_t dDEta = Jet_eta[ nIdxJet ] - GenJet_eta[ i ];
Float_t dDPhi = Jet_phi[ nIdxJet ] - GenJet_phi[ i ];

while ( dDPhi > 3.141592 ) dDPhi -= 2 * 3.141592;
while ( dDPhi < -3.141592 ) dDPhi += 2 * 3.141592;

Float_t dR = sqrt(dDEta * dDEta + dDPhi * dDPhi);
dR = deltaR(Jet_eta[ nIdxJet ], Jet_phi[ nIdxJet ], GenJet_eta[ i ], GenJet_phi[ i ]);

if ( dR >= m_fDRcone_JER * 0.5 ) continue;
if ( dRFound > dR ) {
Expand All @@ -330,7 +325,7 @@ Int_t topObjectSelection::GetMatchGenJet(UInt_t nIdxJet, Float_t fResolution) {
}
}

return ( dRFound < m_fDRcone_JER ? (Int_t)nIdxFound : -1 );
return ( dRFound < 0.75 * m_fDRcone_JER ? (Int_t)nIdxFound : -1 );
}


0 comments on commit 0c21443

Please sign in to comment.