CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Functions
pfalgo_common_ref.h File Reference
#include "../firmware/data.h"
#include "../firmware/pfalgo_common.h"
#include <algorithm>

Go to the source code of this file.

Classes

struct  pfalgo_config
 

Functions

template<typename CO_t >
int best_match_with_pt_ref (int nCAL, int dR2MAX, const CO_t calo[], const TkObj &track)
 
void pfalgo_mu_ref (const pfalgo_config &cfg, const TkObj track[], const MuObj mu[], bool isMu[], PFChargedObj outmu[], bool debug)
 
template<typename T >
void ptsort_ref (int nIn, int nOut, const T in[], T out[])
 
template<typename T , typename TV >
void ptsort_ref (int nIn, int nOut, const TV &in, T out[])
 
template<typename T >
int sqr (const T &t)
 

Function Documentation

template<typename CO_t >
int best_match_with_pt_ref ( int  nCAL,
int  dR2MAX,
const CO_t  calo[],
const TkObj track 
)

Definition at line 56 of file pfalgo_common_ref.h.

References runTauDisplay::dr, dr2_int(), TkObj::hwEta, TkObj::hwPhi, TkObj::hwPt, TkObj::hwPtErr, and sqr().

56  {
57  pt_t caloPtMin = track.hwPt - 2 * (track.hwPtErr);
58  if (caloPtMin < 0)
59  caloPtMin = 0;
60  int dptscale = (dR2MAX << 8) / std::max<int>(1, sqr(track.hwPtErr));
61  int drmin = 0, ibest = -1;
62  for (int ic = 0; ic < nCAL; ++ic) {
63  if (calo[ic].hwPt <= caloPtMin)
64  continue;
65  int dr = dr2_int(track.hwEta, track.hwPhi, calo[ic].hwEta, calo[ic].hwPhi);
66  if (dr >= dR2MAX)
67  continue;
68  dr += ((sqr(std::max<int>(track.hwPt - calo[ic].hwPt, 0)) * dptscale) >> 8);
69  if (ibest == -1 || dr < drmin) {
70  drmin = dr;
71  ibest = ic;
72  }
73  }
74  return ibest;
75 }
int dr2_int(etaphi_t eta1, etaphi_t phi1, etaphi_t eta2, etaphi_t phi2)
Definition: pfalgo_common.h:6
int sqr(const T &t)
pt_t hwPt
Definition: data.h:144
pt_t hwPtErr
Definition: data.h:144
ap_int< 16 > pt_t
Definition: data.h:6
etaphi_t hwPhi
Definition: data.h:145
etaphi_t hwEta
Definition: data.h:145
void pfalgo_mu_ref ( const pfalgo_config cfg,
const TkObj  track[],
const MuObj  mu[],
bool  isMu[],
PFChargedObj  outmu[],
bool  debug 
)
template<typename T >
void ptsort_ref ( int  nIn,
int  nOut,
const T  in[],
T  out[] 
)
template<typename T , typename TV >
void ptsort_ref ( int  nIn,
int  nOut,
const TV &  in,
T  out[] 
)

Definition at line 78 of file pfalgo_common_ref.h.

78  {
79  for (int iout = 0; iout < nOut; ++iout) {
80  out[iout].hwPt = 0;
81  }
82  for (int it = 0; it < nIn; ++it) {
83  for (int iout = 0; iout < nOut; ++iout) {
84  if (in[it].hwPt >= out[iout].hwPt) {
85  for (int i2 = nOut - 1; i2 > iout; --i2) {
86  out[i2] = out[i2 - 1];
87  }
88  out[iout] = in[it];
89  break;
90  }
91  }
92  }
93 }
template<typename T >
int sqr ( const T t)
inline

Definition at line 9 of file pfalgo_common_ref.h.

References submitPVValidationJobs::t.

Referenced by ThirdHitPredictionFromInvLine::add(), MonopoleTransportation::AlongStepGetPhysicalInteractionLength(), ThirdHitPredictionFromCircle::angle(), best_match_with_pt_ref(), PixelTrackBuilder::build(), ThirdHitPrediction::calculateRangesBarrel(), ThirdHitPredictionFromInvLine::check(), GlobalTrackingRegion::checkRZ(), HitPairGeneratorFromLayerPairForPhotonConversion::checkRZCompatibilityWithSeedTrack(), RectangularEtaPhiTrackingRegion::checkRZOld(), ParabolaFit::chi2(), MuonSeedFromRecHits::createSeed(), ThirdHitPredictionFromInvLine::crossing(), ThirdHitPredictionFromCircle::curvature(), MSLayer::distance2(), RectangularEtaPhiTrackingRegion::estimator(), HitQuadrupletGeneratorFromLayerPairForPhotonConversion::failCheckRZCompatibility(), ThirdHitPrediction::findMinimalCircles(), ThirdHitPrediction::findRectangle(), ThirdHitPrediction::findTouchingCircles(), ThirdHitPrediction::fitParabola(), FullModelReactionDynamics::GenerateXandPt(), L1MuonPixelTrackFitter::getBendingError(), HitQuadrupletGeneratorFromLayerPairForPhotonConversion::getEffectiveErrorOnZ(), ClusterShapeTrackFilter::getGlobalDirs(), HitPairGeneratorFromLayerPairForPhotonConversion::getPhiRange(), HitQuadrupletGeneratorFromLayerPairForPhotonConversion::getSqrEffectiveErrorOnZ(), SeedForPhotonConversionFromQuadruplets::getSqrEffectiveErrorOnZ(), CAHitTripletGenerator::hitNtuplets(), CAHitQuadrupletGenerator::hitNtuplets(), HitPairGeneratorFromLayerPairForPhotonConversion::hitPairs(), PixelTripletNoTipGenerator::hitTriplets(), ThirdHitCorrection::init(), SeedFromConsecutiveHitsCreator::initialError(), SeedForPhotonConversion1Leg::initialError(), SeedForPhotonConversionFromQuadruplets::initialError(), ThirdHitPrediction::invertCircle(), ThirdHitPrediction::isCompatibleWithMultipleScattering(), JacobianLocalToCartesian::JacobianLocalToCartesian(), SeedFromConsecutiveHitsCreator::makeSeed(), MatchJet::matchCollections(), RKCurvilinearDistance< T, N >::momentum(), KFBasedPixelFitter::MyBeamSpotHit::MyBeamSpotHit(), PixelTrackFilterByKinematics::operator()(), RKCurvilinearDistance< T, N >::operator()(), ThirdHitZPrediction::operator()(), ThirdHitPredictionFromCircle::phi(), InnerDeltaPhi::phiRange(), SeedGeneratorFromProtoTracksEDProducer::produce(), ThirdHitPredictionFromCircle::HelixRZ::rAtZ(), reco::GhostTrackVertexFinder::reassignTracks(), ThirdHitPredictionFromInvLine::remove(), PrimaryVertexResolution::Resolution::Resolution(), ParabolaFit::result(), PixelFitterByConformalMappingAndLine::run(), KFBasedPixelFitter::run(), PhotonConversionTrajectorySeedProducerFromSingleLegAlgo::selectPriVtxCompatibleWithTrack(), MSLayersKeeperX0AtEta::setX0(), SeedForPhotonConversionFromQuadruplets::simpleGetSlope(), reco::SequentialGhostTrackFitter::stable(), MSLayersAtAngle::sumX0D(), ThirdHitPredictionFromCircle::transverseIP(), reco::GhostTrackVertexFinder::vertexCompat(), reco::TrackGhostTrackState::vertexStateOnGhostTrack(), reco::TrackGhostTrackState::vertexStateOnMeasurement(), and ThirdHitPredictionFromCircle::HelixRZ::zAtR().

9  {
10  return t * t;
11 }