-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge CMSSW_10_6_X into CMSSW_10_6_DEVEL_X.
- Loading branch information
Showing
6 changed files
with
131 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
RecoEgamma/EgammaElectronAlgos/interface/GsfElectronTools.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#ifndef RecoEgamma_EgammaElectronAlgos_GsfElectronTools_h | ||
#define RecoEgamma_EgammaElectronAlgos_GsfElectronTools_h | ||
|
||
#include "DataFormats/Common/interface/Handle.h" | ||
#include "DataFormats/GsfTrackReco/interface/GsfTrackFwd.h" | ||
#include "DataFormats/TrackReco/interface/TrackFwd.h" | ||
|
||
namespace GsfElectronTools { | ||
|
||
// From Puneeth Kalavase : returns the CTF track that has the highest fraction | ||
// of shared hits in Pixels and the inner strip tracker with the electron Track | ||
std::pair<reco::TrackRef,float> getClosestCtfToGsf( reco::GsfTrackRef const&, | ||
edm::Handle<reco::TrackCollection> const& ctfTracksH ); | ||
|
||
} | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#include "DataFormats/EgammaCandidates/interface/GsfElectronCoreFwd.h" | ||
#include "DataFormats/EgammaCandidates/interface/GsfElectronCore.h" | ||
#include "DataFormats/ParticleFlowReco/interface/GsfPFRecTrack.h" | ||
#include "DataFormats/GsfTrackReco/interface/GsfTrack.h" | ||
#include "DataFormats/EgammaReco/interface/ElectronSeedFwd.h" | ||
#include "DataFormats/EgammaReco/interface/ElectronSeed.h" | ||
#include "RecoEgamma/EgammaElectronAlgos/interface/GsfElectronTools.h" | ||
|
||
namespace GsfElectronTools { | ||
|
||
using namespace reco ; | ||
|
||
//======================================================================================= | ||
// Code from Puneeth Kalavase | ||
//======================================================================================= | ||
|
||
std::pair<TrackRef,float> getClosestCtfToGsf( GsfTrackRef const& gsfTrackRef, | ||
edm::Handle<reco::TrackCollection> const& ctfTracksH ) | ||
{ | ||
float maxFracShared = 0; | ||
TrackRef ctfTrackRef = TrackRef() ; | ||
const TrackCollection * ctfTrackCollection = ctfTracksH.product() ; | ||
|
||
// get the Hit Pattern for the gsfTrack | ||
const HitPattern& gsfHitPattern = gsfTrackRef->hitPattern(); | ||
|
||
unsigned int counter = 0; | ||
for (auto ctfTkIter = ctfTrackCollection->begin(); | ||
ctfTkIter != ctfTrackCollection->end() ; ctfTkIter++, counter++ ) | ||
{ | ||
|
||
double dEta = gsfTrackRef->eta() - ctfTkIter->eta(); | ||
double dPhi = gsfTrackRef->phi() - ctfTkIter->phi(); | ||
double pi = acos(-1.); | ||
if(std::abs(dPhi) > pi) dPhi = 2*pi - std::abs(dPhi); | ||
|
||
// dont want to look at every single track in the event! | ||
if(sqrt(dEta*dEta + dPhi*dPhi) > 0.3) continue; | ||
|
||
unsigned int shared = 0 ; | ||
int gsfHitCounter = 0 ; | ||
int numGsfInnerHits = 0 ; | ||
int numCtfInnerHits = 0 ; | ||
// get the CTF Track Hit Pattern | ||
const HitPattern& ctfHitPattern = ctfTkIter->hitPattern(); | ||
|
||
for ( auto elHitsIt = gsfTrackRef->recHitsBegin() ; | ||
elHitsIt != gsfTrackRef->recHitsEnd() ; | ||
elHitsIt++, gsfHitCounter++ ) | ||
{ | ||
if(!((**elHitsIt).isValid())) //count only valid Hits | ||
{ continue ; } | ||
|
||
// look only in the pixels/TIB/TID | ||
uint32_t gsfHit = gsfHitPattern.getHitPattern(HitPattern::TRACK_HITS, gsfHitCounter); | ||
if (!(HitPattern::pixelHitFilter(gsfHit) || | ||
HitPattern::stripTIBHitFilter(gsfHit) || | ||
HitPattern::stripTIDHitFilter(gsfHit))) | ||
{ continue ; } | ||
|
||
numGsfInnerHits++ ; | ||
|
||
int ctfHitsCounter = 0 ; | ||
numCtfInnerHits = 0 ; | ||
for ( auto ctfHitsIt = ctfTkIter->recHitsBegin() ; | ||
ctfHitsIt != ctfTkIter->recHitsEnd() ; | ||
ctfHitsIt++, ctfHitsCounter++ ) | ||
{ | ||
if(!((**ctfHitsIt).isValid())) //count only valid Hits! | ||
{ continue ; } | ||
|
||
uint32_t ctfHit = ctfHitPattern.getHitPattern(HitPattern::TRACK_HITS, ctfHitsCounter); | ||
if(!(HitPattern::pixelHitFilter(ctfHit) || | ||
HitPattern::stripTIBHitFilter(ctfHit) || | ||
HitPattern::stripTIDHitFilter(ctfHit))) | ||
{ continue ; } | ||
|
||
numCtfInnerHits++ ; | ||
|
||
if( (**elHitsIt).sharesInput(&(**ctfHitsIt),TrackingRecHit::all) ) | ||
{ | ||
shared++ ; | ||
break ; | ||
} | ||
|
||
} //ctfHits iterator | ||
|
||
} //gsfHits iterator | ||
|
||
if ((numGsfInnerHits==0)||(numCtfInnerHits==0)) | ||
{ continue ; } | ||
|
||
if ( static_cast<float>(shared)/std::min(numGsfInnerHits,numCtfInnerHits) > maxFracShared ) | ||
{ | ||
maxFracShared = static_cast<float>(shared)/std::min(numGsfInnerHits, numCtfInnerHits); | ||
ctfTrackRef = TrackRef(ctfTracksH,counter); | ||
} | ||
|
||
} //ctfTrack iterator | ||
|
||
return make_pair(ctfTrackRef,maxFracShared) ; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters