CMS 3D CMS Logo

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

◆ best_match_with_pt_ref()

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 flavorHistoryFilter_cfi::dr, dr2_int(), sqr(), and HLT_2022v12_cff::track.

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)
ap_int< 16 > pt_t
Definition: data.h:6
Definition: Common.h:9

◆ pfalgo_mu_ref()

void pfalgo_mu_ref ( const pfalgo_config cfg,
const TkObj  track[],
const MuObj  mu[],
bool  isMu[],
PFChargedObj  outmu[],
bool  debug 
)

◆ ptsort_ref() [1/2]

template<typename T >
void ptsort_ref ( int  nIn,
int  nOut,
const T  in[],
T  out[] 
)

◆ ptsort_ref() [2/2]

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.

References testProducerWithPsetDescEmpty_cfi::i2, recoMuon::in, and MillePedeFileConverter_cfg::out.

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 }

◆ sqr()

template<typename T >
int sqr ( const T t)
inline

Definition at line 9 of file pfalgo_common_ref.h.

References submitPVValidationJobs::t.

Referenced by MonopoleTransportation::AlongStepGetPhysicalInteractionLength(), ThirdHitPredictionFromCircle::angle(), best_match_with_pt_ref(), HitPairGeneratorFromLayerPairForPhotonConversion::checkRZCompatibilityWithSeedTrack(), RectangularEtaPhiTrackingRegion::checkRZOld(), ThirdHitPredictionFromCircle::curvature(), RectangularEtaPhiTrackingRegion::estimator(), FullModelReactionDynamics::GenerateXandPt(), HitPairGeneratorFromLayerPairForPhotonConversion::getPhiRange(), CAHitTripletGenerator::hitNtuplets(), CAHitQuadrupletGenerator::hitNtuplets(), HitPairGeneratorFromLayerPairForPhotonConversion::hitPairs(), ThirdHitCorrection::init(), SeedFromConsecutiveHitsCreator::initialError(), SeedForPhotonConversion1Leg::initialError(), JacobianLocalToCartesian::JacobianLocalToCartesian(), SeedFromConsecutiveHitsCreator::makeSeed(), MatchJet::matchCollections(), RKCurvilinearDistance< T, N >::momentum(), RKCurvilinearDistance< T, N >::operator()(), ThirdHitZPrediction::operator()(), ThirdHitPredictionFromCircle::phi(), InnerDeltaPhi::phiRange(), ThirdHitPredictionFromCircle::HelixRZ::rAtZ(), reco::GhostTrackVertexFinder::reassignTracks(), PrimaryVertexResolution::Resolution::Resolution(), PhotonConversionTrajectorySeedProducerFromSingleLegAlgo::selectPriVtxCompatibleWithTrack(), MSLayersKeeperX0AtEta::setX0(), 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 }