19 float maxFracShared = 0;
23 float gsfEta = gsfTrackRef->eta();
24 float gsfPhi = gsfTrackRef->phi();
25 const HitPattern& gsfHitPattern = gsfTrackRef->hitPattern();
27 constexpr
float dR2 = 0.3 * 0.3;
30 for (
auto ctfTkIter = ctfTrackCollection->begin(); ctfTkIter != ctfTrackCollection->end(); ctfTkIter++, counter++) {
33 if (
reco::deltaR2(gsfEta, gsfPhi, trackTable.get<
Eta>(counter), trackTable.get<
Phi>(counter)) > dR2)
36 unsigned int shared = 0;
37 int gsfHitCounter = 0;
38 int numGsfInnerHits = 0;
39 int numCtfInnerHits = 0;
43 for (
auto elHitsIt = gsfTrackRef->recHitsBegin(); elHitsIt != gsfTrackRef->recHitsEnd();
44 elHitsIt++, gsfHitCounter++) {
45 if (!((**elHitsIt).isValid()))
59 int ctfHitsCounter = 0;
61 for (
auto ctfHitsIt = ctfTkIter->recHitsBegin(); ctfHitsIt != ctfTkIter->recHitsEnd();
62 ctfHitsIt++, ctfHitsCounter++) {
63 if (!((**ctfHitsIt).isValid()))
85 if ((numGsfInnerHits == 0) || (numCtfInnerHits == 0)) {
89 if (static_cast<float>(shared) /
std::min(numGsfInnerHits, numCtfInnerHits) > maxFracShared) {
90 maxFracShared =
static_cast<float>(shared) /
std::min(numGsfInnerHits, numCtfInnerHits);
91 ctfTrackRef =
TrackRef(ctfTracksH, counter);
96 return {ctfTrackRef, maxFracShared};
std::pair< reco::TrackRef, float > getClosestCtfToGsf(reco::GsfTrackRef const &, edm::Handle< reco::TrackCollection > const &ctfTracksH, edm::soa::EtaPhiTableView trackEtaPhiTable)
static bool pixelHitFilter(uint16_t pattern)
std::vector< Track > TrackCollection
collection of Tracks
uint16_t hitPattern[ARRAY_LENGTH]
edm::soa::ViewFromTable_t< EtaPhiTable > EtaPhiTableView
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
T const * product() const
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
static bool stripTIBHitFilter(uint16_t pattern)
static std::atomic< unsigned int > counter
uint16_t getHitPattern(HitCategory category, int position) const
static bool stripTIDHitFilter(uint16_t pattern)