CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
mkfit::Track Class Reference

#include <Track.h>

Inheritance diagram for mkfit::Track:
mkfit::TrackBase

Public Member Functions

void addHitIdx (int hitIdx, int hitLyr, float chi2)
 
void addHitIdx (const HitOnTrack &hot, float chi2)
 
const HitOnTrackbeginHitsOnTrack () const
 
HitOnTrackbeginHitsOnTrack_nc ()
 
bool canReachRadius (float R) const
 
void countAndSetNFoundHits ()
 
const HitOnTrackendHitsOnTrack () const
 
std::vector< int > foundLayers () const
 
int getHitIdx (int posHitIdx) const
 
int getHitLyr (int posHitIdx) const
 
HitOnTrack getHitOnTrack (int posHitIdx) const
 
const HitOnTrackgetHitsOnTrackArray () const
 
int getLastFoundHitIdx () const
 
int getLastFoundHitLyr () const
 
HitOnTrack getLastFoundHitOnTrack () const
 
int getLastFoundHitPos () const
 
int getLastFoundMCHitID (const std::vector< HitVec > &globalHitVec) const
 
int getLastHitIdx () const
 
int getLastHitLyr () const
 
HitOnTrack getLastHitOnTrack () const
 
int getMCHitIDFromLayer (const std::vector< HitVec > &globalHitVec, int layer) const
 
HitVec hitsVector (const std::vector< HitVec > &globalHitVec) const
 
float maxReachRadius () const
 
void mcHitIDsVec (const std::vector< HitVec > &globalHitVec, const MCHitInfoVec &globalMCHitInfo, std::vector< int > &mcHitIDs) const
 
int nFoundHits () const
 
int nInsideMinusOneHits () const
 
int nOverlapHits () const
 
int nTailMinusOneHits () const
 
int nTotalHits () const
 
int nUniqueLayers () const
 
float rAtZ (float Z) const
 
void reserveHits (int nHits)
 
void resetHits ()
 
void resizeHits (int nHits, int nFoundHits)
 
void resizeHitsForInput ()
 
void setHitIdx (int posHitIdx, int newIdx)
 
void setHitIdxAtPos (int pos, const HitOnTrack &hot)
 
void setHitIdxLyr (int posHitIdx, int newIdx, int newLyr)
 
void setNOverlapHits (int n)
 
void sortHitsByLayer ()
 
float swimPhiToR (const float x, const float y) const
 
 Track ()
 
 Track (const TrackBase &base)
 
 Track (const TrackState &state, float chi2, int label, int nHits, const HitOnTrack *hits)
 
 Track (int charge, const SVector3 &position, const SVector3 &momentum, const SMatrixSym66 &errors, float chi2)
 
 Track (const Track &t)
 
float zAtR (float R, float *r_reached=nullptr) const
 
- Public Member Functions inherited from mkfit::TrackBase
int algoint () const
 
TrackAlgorithm algorithm () const
 
int charge () const
 
float chi2 () const
 
float d0BeamSpot (const float x_bs, const float y_bs, bool linearize=false) const
 
float emomEta () const
 
float emomPhi () const
 
float epT () const
 
const float * errArray () const
 
const SMatrixSym66errors () const
 
SMatrixSym66errors_nc ()
 
bool getDuplicateValue () const
 
int getEtaRegion () const
 
int getNSeedHits () const
 
Status getStatus () const
 
bool hasNanNSillyValues () const
 
bool hasSillyValues (bool dump, bool fix, const char *pref="")
 
float invpT () const
 
bool isFindable () const
 
bool isNotFindable () const
 
int label () const
 
SVector3 momentum () const
 
float momEta () const
 
float momPhi () const
 
float p () const
 
const SVector6parameters () const
 
SVector6parameters_nc ()
 
const float * posArray () const
 
float posEta () const
 
SVector3 position () const
 
float posPhi () const
 
float posR () const
 
float posRsq () const
 
ProdType prodType () const
 
float pT () const
 
float px () const
 
float py () const
 
float pz () const
 
float score () const
 
void setAlgoint (int algo)
 
void setAlgorithm (TrackAlgorithm algo)
 
void setCharge (int chg)
 
void setChi2 (float chi2)
 
void setDuplicateValue (bool d)
 
void setEtaRegion (int r)
 
void setLabel (int lbl)
 
void setNotFindable ()
 
void setNSeedHits (int n)
 
void setProdType (ProdType ptyp)
 
void setScore (float s)
 
void setState (const TrackState &newState)
 
void setStatus (Status s)
 
const TrackStatestate () const
 
TrackStatestate_nc ()
 
float theta () const
 
 TrackBase ()
 
 TrackBase (const TrackState &state, float chi2, int label)
 
 TrackBase (int charge, const SVector3 &position, const SVector3 &momentum, const SMatrixSym66 &errors, float chi2)
 
float x () const
 
float y () const
 
float z () const
 

Private Attributes

std::vector< HitOnTrackhitsOnTrk_
 

Additional Inherited Members

- Public Types inherited from mkfit::TrackBase
enum  ProdType { ProdType::NotSet = 0, ProdType::Signal = 1, ProdType::InTimePU = 2, ProdType::OutOfTimePU = 3 }
 
enum  TrackAlgorithm {
  TrackAlgorithm::undefAlgorithm = 0, TrackAlgorithm::ctf = 1, TrackAlgorithm::duplicateMerge = 2, TrackAlgorithm::cosmics = 3,
  TrackAlgorithm::initialStep = 4, TrackAlgorithm::lowPtTripletStep = 5, TrackAlgorithm::pixelPairStep = 6, TrackAlgorithm::detachedTripletStep = 7,
  TrackAlgorithm::mixedTripletStep = 8, TrackAlgorithm::pixelLessStep = 9, TrackAlgorithm::tobTecStep = 10, TrackAlgorithm::jetCoreRegionalStep = 11,
  TrackAlgorithm::conversionStep = 12, TrackAlgorithm::muonSeededStepInOut = 13, TrackAlgorithm::muonSeededStepOutIn = 14, TrackAlgorithm::outInEcalSeededConv = 15,
  TrackAlgorithm::inOutEcalSeededConv = 16, TrackAlgorithm::nuclInter = 17, TrackAlgorithm::standAloneMuon = 18, TrackAlgorithm::globalMuon = 19,
  TrackAlgorithm::cosmicStandAloneMuon = 20, TrackAlgorithm::cosmicGlobalMuon = 21, TrackAlgorithm::highPtTripletStep = 22, TrackAlgorithm::lowPtQuadStep = 23,
  TrackAlgorithm::detachedQuadStep = 24, TrackAlgorithm::reservedForUpgrades1 = 25, TrackAlgorithm::reservedForUpgrades2 = 26, TrackAlgorithm::bTagGhostTracks = 27,
  TrackAlgorithm::beamhalo = 28, TrackAlgorithm::gsf = 29, TrackAlgorithm::hltPixel = 30, TrackAlgorithm::hltIter0 = 31,
  TrackAlgorithm::hltIter1 = 32, TrackAlgorithm::hltIter2 = 33, TrackAlgorithm::hltIter3 = 34, TrackAlgorithm::hltIter4 = 35,
  TrackAlgorithm::hltIterX = 36, TrackAlgorithm::hiRegitMuInitialStep = 37, TrackAlgorithm::hiRegitMuLowPtTripletStep = 38, TrackAlgorithm::hiRegitMuPixelPairStep = 39,
  TrackAlgorithm::hiRegitMuDetachedTripletStep = 40, TrackAlgorithm::hiRegitMuMixedTripletStep = 41, TrackAlgorithm::hiRegitMuPixelLessStep = 42, TrackAlgorithm::hiRegitMuTobTecStep = 43,
  TrackAlgorithm::hiRegitMuMuonSeededStepInOut = 44, TrackAlgorithm::hiRegitMuMuonSeededStepOutIn = 45, TrackAlgorithm::algoSize = 46
}
 track algorithm; copy from TrackBase.h to keep in standalone builds More...
 
- Static Public Member Functions inherited from mkfit::TrackBase
static const char * algoint_to_cstr (int algo)
 
- Protected Attributes inherited from mkfit::TrackBase
float chi2_ = 0.
 
int label_ = -1
 
short int lastHitIdx_ = -1
 
short int nFoundHits_ = 0
 
float score_ = 0.
 
TrackState state_
 
Status status_
 

Detailed Description

Definition at line 365 of file Track.h.

Constructor & Destructor Documentation

◆ Track() [1/5]

mkfit::Track::Track ( )
inline

Definition at line 367 of file Track.h.

367 {}

◆ Track() [2/5]

mkfit::Track::Track ( const TrackBase base)
inlineexplicit

Definition at line 369 of file Track.h.

References mkfit::TrackBase::lastHitIdx_, and mkfit::TrackBase::nFoundHits_.

369  : TrackBase(base) {
370  // Reset hit counters -- caller has to initialize hits.
371  lastHitIdx_ = -1;
372  nFoundHits_ = 0;
373  }
base
Main Program
Definition: newFWLiteAna.py:92
short int nFoundHits_
Definition: Track.h:347
short int lastHitIdx_
Definition: Track.h:346

◆ Track() [3/5]

mkfit::Track::Track ( const TrackState state,
float  chi2,
int  label,
int  nHits,
const HitOnTrack hits 
)
inline

Definition at line 375 of file Track.h.

References addHitIdx(), f, h, hfClusterShapes_cfi::hits, nHits, and reserveHits().

376  : TrackBase(state, chi2, label) {
378  for (int h = 0; h < nHits; ++h) {
379  addHitIdx(hits[h].index, hits[h].layer, 0.0f);
380  }
381  }
float chi2() const
Definition: Track.h:184
int label() const
Definition: Track.h:186
constexpr std::array< uint8_t, layerIndexSize > layer
void reserveHits(int nHits)
Definition: Track.h:423
double f[11][100]
void addHitIdx(int hitIdx, int hitLyr, float chi2)
Definition: Track.h:442
const TrackState & state() const
Definition: Track.h:141
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t nHits
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ Track() [4/5]

mkfit::Track::Track ( int  charge,
const SVector3 position,
const SVector3 momentum,
const SMatrixSym66 errors,
float  chi2 
)
inline

Definition at line 383 of file Track.h.

int charge() const
Definition: Track.h:183
float chi2() const
Definition: Track.h:184
SVector3 momentum() const
Definition: Track.h:156
SVector3 position() const
Definition: Track.h:155
Definition: errors.py:1

◆ Track() [5/5]

mkfit::Track::Track ( const Track t)
inline

Definition at line 386 of file Track.h.

386 : TrackBase(t), hitsOnTrk_(t.hitsOnTrk_) {}
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584

Member Function Documentation

◆ addHitIdx() [1/2]

void mkfit::Track::addHitIdx ( int  hitIdx,
int  hitLyr,
float  chi2 
)
inline

Definition at line 442 of file Track.h.

References mkfit::TrackBase::chi2(), mkfit::TrackBase::chi2_, hitsOnTrk_, mkfit::TrackBase::lastHitIdx_, and mkfit::TrackBase::nFoundHits_.

Referenced by mkfit::StdSeq::clean_cms_seedtracks_iter(), and Track().

442  {
443  hitsOnTrk_.push_back({hitIdx, hitLyr});
444  ++lastHitIdx_;
445  if (hitIdx >= 0 || hitIdx == -9) {
446  ++nFoundHits_;
447  chi2_ += chi2;
448  }
449  }
float chi2_
Definition: Track.h:344
float chi2() const
Definition: Track.h:184
short int nFoundHits_
Definition: Track.h:347
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584
short int lastHitIdx_
Definition: Track.h:346

◆ addHitIdx() [2/2]

void mkfit::Track::addHitIdx ( const HitOnTrack hot,
float  chi2 
)
inline

Definition at line 451 of file Track.h.

References addHitIdx(), mkfit::TrackBase::chi2(), mkfit::HitOnTrack::index, and mkfit::HitOnTrack::layer.

Referenced by addHitIdx().

451 { addHitIdx(hot.index, hot.layer, chi2); }
float chi2() const
Definition: Track.h:184
void addHitIdx(int hitIdx, int hitLyr, float chi2)
Definition: Track.h:442

◆ beginHitsOnTrack()

const HitOnTrack* mkfit::Track::beginHitsOnTrack ( ) const
inline

Definition at line 499 of file Track.h.

References hitsOnTrk_.

Referenced by mkfit::MkFinder::copy_in().

499 { return hitsOnTrk_.data(); }
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584

◆ beginHitsOnTrack_nc()

HitOnTrack* mkfit::Track::beginHitsOnTrack_nc ( )
inline

Definition at line 502 of file Track.h.

References hitsOnTrk_.

Referenced by mkfit::MkFinder::copy_out().

502 { return hitsOnTrk_.data(); }
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584

◆ canReachRadius()

bool mkfit::Track::canReachRadius ( float  R) const

Definition at line 282 of file Track.cc.

References funct::abs(), mkfit::Config::Bfield, mkfit::TrackBase::charge(), f, dqmdumpme::k, mkfit::TrackBase::pT(), dttmaxenums::R, mkfit::Const::sol, mkfit::TrackBase::x(), and mkfit::TrackBase::y().

282  {
283  const float k = ((charge() < 0) ? 100.0f : -100.0f) / (Const::sol * Config::Bfield);
284  const float ooc = 2.0f * k * pT();
285  return std::abs(ooc) > R - std::hypot(x(), y());
286  }
int charge() const
Definition: Track.h:183
float pT() const
Definition: Track.h:169
float y() const
Definition: Track.h:159
constexpr float Bfield
Definition: Config.h:88
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
constexpr float sol
Definition: Config.h:48
float x() const
Definition: Track.h:158

◆ countAndSetNFoundHits()

void mkfit::Track::countAndSetNFoundHits ( )
inline

Definition at line 508 of file Track.h.

References hitsOnTrk_, mps_fire::i, mkfit::TrackBase::lastHitIdx_, and mkfit::TrackBase::nFoundHits_.

508  {
509  nFoundHits_ = 0;
510  for (int i = 0; i <= lastHitIdx_; i++) {
511  if (hitsOnTrk_[i].index >= 0 || hitsOnTrk_[i].index == -9)
512  nFoundHits_++;
513  }
514  }
short int nFoundHits_
Definition: Track.h:347
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584
short int lastHitIdx_
Definition: Track.h:346

◆ endHitsOnTrack()

const HitOnTrack* mkfit::Track::endHitsOnTrack ( ) const
inline

Definition at line 500 of file Track.h.

References hitsOnTrk_, and mkfit::TrackBase::lastHitIdx_.

Referenced by mkfit::MkFinder::copy_in().

500 { return hitsOnTrk_.data() + (lastHitIdx_ + 1); }
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584
short int lastHitIdx_
Definition: Track.h:346

◆ foundLayers()

std::vector<int> mkfit::Track::foundLayers ( ) const
inline

Definition at line 573 of file Track.h.

References hitsOnTrk_, mkfit::TrackBase::lastHitIdx_, and hgcalTopologyTester_cfi::layers.

573  {
574  std::vector<int> layers;
575  for (int ihit = 0; ihit <= lastHitIdx_; ++ihit) {
576  if (hitsOnTrk_[ihit].index >= 0 || hitsOnTrk_[ihit].index == -9) {
577  layers.push_back(hitsOnTrk_[ihit].layer);
578  }
579  }
580  return layers;
581  }
constexpr std::array< uint8_t, layerIndexSize > layer
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584
short int lastHitIdx_
Definition: Track.h:346

◆ getHitIdx()

int mkfit::Track::getHitIdx ( int  posHitIdx) const
inline

◆ getHitLyr()

int mkfit::Track::getHitLyr ( int  posHitIdx) const
inline

◆ getHitOnTrack()

HitOnTrack mkfit::Track::getHitOnTrack ( int  posHitIdx) const
inline

Definition at line 453 of file Track.h.

References hitsOnTrk_.

Referenced by mkfit::MkFitter::inputSeedsTracksAndHits(), mkfit::MkFitter::inputTracksAndHitIdx(), and mkfit::MkFitter::inputTracksAndHits().

453 { return hitsOnTrk_[posHitIdx]; }
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584

◆ getHitsOnTrackArray()

const HitOnTrack* mkfit::Track::getHitsOnTrackArray ( ) const
inline

Definition at line 498 of file Track.h.

References hitsOnTrk_.

Referenced by mkfit::MkFinder::bkFitInputTracks(), and mkfit::MkFitter::inputTracksForFit().

498 { return hitsOnTrk_.data(); }
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584

◆ getLastFoundHitIdx()

int mkfit::Track::getLastFoundHitIdx ( ) const
inline

Definition at line 473 of file Track.h.

References getLastFoundHitPos(), hitsOnTrk_, and mkfit::TrackBase::p().

473  {
474  int p = getLastFoundHitPos();
475  return p >= 0 ? hitsOnTrk_[p].index : -1;
476  }
float p() const
Definition: Track.h:171
int getLastFoundHitPos() const
Definition: Track.h:462
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584

◆ getLastFoundHitLyr()

int mkfit::Track::getLastFoundHitLyr ( ) const
inline

Definition at line 477 of file Track.h.

References getLastFoundHitPos(), hitsOnTrk_, and mkfit::TrackBase::p().

477  {
478  int p = getLastFoundHitPos();
479  return p >= 0 ? hitsOnTrk_[p].layer : -1;
480  }
float p() const
Definition: Track.h:171
int getLastFoundHitPos() const
Definition: Track.h:462
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584

◆ getLastFoundHitOnTrack()

HitOnTrack mkfit::Track::getLastFoundHitOnTrack ( ) const
inline

Definition at line 469 of file Track.h.

References getLastFoundHitPos(), hitsOnTrk_, and mkfit::TrackBase::p().

Referenced by getLastFoundMCHitID().

469  {
470  int p = getLastFoundHitPos();
471  return p >= 0 ? hitsOnTrk_[p] : HitOnTrack(-1, -1);
472  }
float p() const
Definition: Track.h:171
int getLastFoundHitPos() const
Definition: Track.h:462
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584

◆ getLastFoundHitPos()

int mkfit::Track::getLastFoundHitPos ( ) const
inline

Definition at line 462 of file Track.h.

References hitsOnTrk_, and mkfit::TrackBase::lastHitIdx_.

Referenced by getLastFoundHitIdx(), getLastFoundHitLyr(), and getLastFoundHitOnTrack().

462  {
463  int hi = lastHitIdx_;
464  while (hi >= 0 && hitsOnTrk_[hi].index < 0)
465  --hi;
466  return hi;
467  }
Definition: EPCuts.h:4
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584
short int lastHitIdx_
Definition: Track.h:346

◆ getLastFoundMCHitID()

int mkfit::Track::getLastFoundMCHitID ( const std::vector< HitVec > &  globalHitVec) const
inline

Definition at line 482 of file Track.h.

References getLastFoundHitOnTrack(), mkfit::HitOnTrack::index, and mkfit::HitOnTrack::layer.

482  {
483  HitOnTrack hot = getLastFoundHitOnTrack();
484  return globalHitVec[hot.layer][hot.index].mcHitID();
485  }
HitOnTrack getLastFoundHitOnTrack() const
Definition: Track.h:469

◆ getLastHitIdx()

int mkfit::Track::getLastHitIdx ( ) const
inline

Definition at line 459 of file Track.h.

References hitsOnTrk_, and mkfit::TrackBase::lastHitIdx_.

459 { return hitsOnTrk_[lastHitIdx_].index; }
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584
short int lastHitIdx_
Definition: Track.h:346

◆ getLastHitLyr()

int mkfit::Track::getLastHitLyr ( ) const
inline

Definition at line 460 of file Track.h.

References hitsOnTrk_, and mkfit::TrackBase::lastHitIdx_.

460 { return hitsOnTrk_[lastHitIdx_].layer; }
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584
short int lastHitIdx_
Definition: Track.h:346

◆ getLastHitOnTrack()

HitOnTrack mkfit::Track::getLastHitOnTrack ( ) const
inline

Definition at line 458 of file Track.h.

References hitsOnTrk_, and mkfit::TrackBase::lastHitIdx_.

458 { return hitsOnTrk_[lastHitIdx_]; }
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584
short int lastHitIdx_
Definition: Track.h:346

◆ getMCHitIDFromLayer()

int mkfit::Track::getMCHitIDFromLayer ( const std::vector< HitVec > &  globalHitVec,
int  layer 
) const
inline

Definition at line 487 of file Track.h.

References hitsOnTrk_, and mkfit::TrackBase::lastHitIdx_.

487  {
488  int mcHitID = -1;
489  for (int ihit = 0; ihit <= lastHitIdx_; ++ihit) {
490  if (hitsOnTrk_[ihit].layer == layer) {
491  mcHitID = globalHitVec[hitsOnTrk_[ihit].layer][hitsOnTrk_[ihit].index].mcHitID();
492  break;
493  }
494  }
495  return mcHitID;
496  }
constexpr std::array< uint8_t, layerIndexSize > layer
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584
short int lastHitIdx_
Definition: Track.h:346

◆ hitsVector()

HitVec mkfit::Track::hitsVector ( const std::vector< HitVec > &  globalHitVec) const
inline

Definition at line 397 of file Track.h.

References hitsOnTrk_, mkfit::HitOnTrack::index, mkfit::HitOnTrack::layer, and mkfit::Config::nMaxTrkHits.

397  {
398  HitVec hitsVec;
399  for (int ihit = 0; ihit < Config::nMaxTrkHits; ++ihit) {
400  const HitOnTrack& hot = hitsOnTrk_[ihit];
401  if (hot.index >= 0) {
402  hitsVec.push_back(globalHitVec[hot.layer][hot.index]);
403  }
404  }
405  return hitsVec;
406  }
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584
std::vector< Hit > HitVec
constexpr int nMaxTrkHits
Definition: Config.h:77

◆ maxReachRadius()

float mkfit::Track::maxReachRadius ( ) const

Definition at line 288 of file Track.cc.

References funct::abs(), mkfit::Config::Bfield, mkfit::TrackBase::charge(), f, dqmdumpme::k, mkfit::TrackBase::pT(), mkfit::TrackBase::px(), mkfit::TrackBase::py(), mkfit::Const::sol, mkfit::TrackBase::x(), and mkfit::TrackBase::y().

288  {
289  const float k = ((charge() < 0) ? 100.0f : -100.0f) / (Const::sol * Config::Bfield);
290  const float abs_ooc_half = std::abs(k * pT());
291  // center of helix in x,y plane
292  const float x_center = x() - k * py();
293  const float y_center = y() + k * px();
294  return std::hypot(x_center, y_center) + abs_ooc_half;
295  }
int charge() const
Definition: Track.h:183
float pT() const
Definition: Track.h:169
float py() const
Definition: Track.h:167
float y() const
Definition: Track.h:159
constexpr float Bfield
Definition: Config.h:88
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
constexpr float sol
Definition: Config.h:48
float px() const
Definition: Track.h:166
float x() const
Definition: Track.h:158

◆ mcHitIDsVec()

void mkfit::Track::mcHitIDsVec ( const std::vector< HitVec > &  globalHitVec,
const MCHitInfoVec globalMCHitInfo,
std::vector< int > &  mcHitIDs 
) const
inline

Definition at line 408 of file Track.h.

References hitsOnTrk_, mkfit::HitOnTrack::index, mkfit::TrackBase::lastHitIdx_, and mkfit::HitOnTrack::layer.

410  {
411  for (int ihit = 0; ihit <= lastHitIdx_; ++ihit) {
412  const HitOnTrack& hot = hitsOnTrk_[ihit];
413  if ((hot.index >= 0) && (static_cast<size_t>(hot.index) < globalHitVec[hot.layer].size())) {
414  mcHitIDs.push_back(globalHitVec[hot.layer][hot.index].mcTrackID(globalMCHitInfo));
415  } else {
416  mcHitIDs.push_back(hot.index);
417  }
418  }
419  }
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584
short int lastHitIdx_
Definition: Track.h:346

◆ nFoundHits()

int mkfit::Track::nFoundHits ( ) const
inline

◆ nInsideMinusOneHits()

int mkfit::Track::nInsideMinusOneHits ( ) const
inline

Definition at line 522 of file Track.h.

References hitsOnTrk_, mps_fire::i, mkfit::TrackBase::lastHitIdx_, and dqmiodumpmetadata::n.

Referenced by mkfit::MkFinder::copy_in(), and mkfit::getScoreCand().

522  {
523  int n = 0;
524  bool insideValid = false;
525  for (int i = lastHitIdx_; i >= 0; --i) {
526  if (hitsOnTrk_[i].index >= 0)
527  insideValid = true;
528  if (insideValid && hitsOnTrk_[i].index == -1)
529  ++n;
530  }
531  return n;
532  }
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584
short int lastHitIdx_
Definition: Track.h:346

◆ nOverlapHits()

int mkfit::Track::nOverlapHits ( ) const
inline

Definition at line 519 of file Track.h.

References mkfit::TrackBase::Status::n_overlaps, and mkfit::TrackBase::status_.

Referenced by mkfit::getScoreCand().

519 { return status_.n_overlaps; }
Status status_
Definition: Track.h:348

◆ nTailMinusOneHits()

int mkfit::Track::nTailMinusOneHits ( ) const
inline

Definition at line 534 of file Track.h.

References hitsOnTrk_, mps_fire::i, mkfit::TrackBase::lastHitIdx_, and dqmiodumpmetadata::n.

Referenced by mkfit::MkFinder::copy_in(), and mkfit::getScoreCand().

534  {
535  int n = 0;
536  for (int i = lastHitIdx_; i >= 0; --i) {
537  if (hitsOnTrk_[i].index >= 0)
538  return n;
539  if (hitsOnTrk_[i].index == -1)
540  ++n;
541  }
542  return n;
543  }
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584
short int lastHitIdx_
Definition: Track.h:346

◆ nTotalHits()

int mkfit::Track::nTotalHits ( ) const
inline

◆ nUniqueLayers()

int mkfit::Track::nUniqueLayers ( ) const
inline

Definition at line 545 of file Track.h.

References hitsOnTrk_, heavyIonCSV_trainingSettings::idx, mkfit::TrackBase::lastHitIdx_, and jetsAK4_CHS_cff::sort.

545  {
546  // make local copy in vector: sort it in place
547  std::vector<HitOnTrack> tmp_hitsOnTrk(hitsOnTrk_.begin(), hitsOnTrk_.end());
548  std::sort(tmp_hitsOnTrk.begin(), tmp_hitsOnTrk.end(), [](const auto& h1, const auto& h2) {
549  return h1.layer < h2.layer;
550  });
551 
552  // local counters
553  auto lyr_cnt = 0;
554  auto prev_lyr = -1;
555 
556  // loop over copy of hitsOnTrk
557  for (auto ihit = 0; ihit <= lastHitIdx_; ++ihit) {
558  const auto& hot = tmp_hitsOnTrk[ihit];
559  const auto lyr = hot.layer;
560  const auto idx = hot.index;
561  if (lyr >= 0 && (idx >= 0 || idx == -9) && lyr != prev_lyr) {
562  ++lyr_cnt;
563  prev_lyr = lyr;
564  }
565  }
566  return lyr_cnt;
567  }
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584
short int lastHitIdx_
Definition: Track.h:346

◆ rAtZ()

float mkfit::Track::rAtZ ( float  Z) const

Definition at line 374 of file Track.cc.

References alpha, mkfit::Config::Bfield, mkfit::TrackBase::charge(), funct::cos(), PVValHelper::dz, f, mkfit::TrackBase::invpT(), dqmdumpme::k, mkfit::TrackBase::px(), mkfit::TrackBase::py(), funct::sin(), mkfit::Const::sol, funct::tan(), mkfit::TrackBase::theta(), mkfit::TrackBase::x(), mkfit::TrackBase::y(), BeamSpotPI::Z, and mkfit::TrackBase::z().

374  {
375  float xc = x();
376  float yc = y();
377  float pxc = px();
378  float pyc = py();
379 
380  const float ipt = invpT();
381  const float kinv = ((charge() < 0) ? 0.01f : -0.01f) * Const::sol * Config::Bfield;
382  const float k = 1.0f / kinv;
383 
384  const float dz = Z - z();
385  const float alpha = dz * ipt * kinv * std::tan(theta());
386 
387  const float cosa = std::cos(alpha);
388  const float sina = std::sin(alpha);
389 
390  xc += k * (pxc * sina - pyc * (1.0f - cosa));
391  yc += k * (pyc * sina + pxc * (1.0f - cosa));
392 
393  // const float pxo = pxc;//copy before overwriting
394  // pxc = pxc * cosa - pyc * sina;
395  // pyc = pyc * cosa + pxo * sina;
396 
397  return std::hypot(xc, yc);
398  }
float alpha
Definition: AMPTWrapper.h:105
int charge() const
Definition: Track.h:183
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
float invpT() const
Definition: Track.h:170
float theta() const
Definition: Track.h:174
float py() const
Definition: Track.h:167
float y() const
Definition: Track.h:159
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
constexpr float Bfield
Definition: Config.h:88
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
double f[11][100]
constexpr float sol
Definition: Config.h:48
float z() const
Definition: Track.h:160
float px() const
Definition: Track.h:166
float x() const
Definition: Track.h:158

◆ reserveHits()

void mkfit::Track::reserveHits ( int  nHits)
inline

Definition at line 423 of file Track.h.

References hitsOnTrk_, and nHits.

Referenced by Track().

423 { hitsOnTrk_.reserve(nHits); }
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t nHits

◆ resetHits()

void mkfit::Track::resetHits ( )
inline

Definition at line 425 of file Track.h.

References hitsOnTrk_, mkfit::TrackBase::lastHitIdx_, and mkfit::TrackBase::nFoundHits_.

425  {
426  lastHitIdx_ = -1;
427  nFoundHits_ = 0;
428  hitsOnTrk_.clear();
429  }
short int nFoundHits_
Definition: Track.h:347
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584
short int lastHitIdx_
Definition: Track.h:346

◆ resizeHits()

void mkfit::Track::resizeHits ( int  nHits,
int  nFoundHits 
)
inline

Definition at line 432 of file Track.h.

References hitsOnTrk_, mkfit::TrackBase::lastHitIdx_, nFoundHits(), mkfit::TrackBase::nFoundHits_, and nHits.

Referenced by mkfit::MkFinder::copy_out().

432  {
433  hitsOnTrk_.resize(nHits);
434  lastHitIdx_ = nHits - 1;
436  }
int nFoundHits() const
Definition: Track.h:516
short int nFoundHits_
Definition: Track.h:347
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584
short int lastHitIdx_
Definition: Track.h:346
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t nHits

◆ resizeHitsForInput()

void mkfit::Track::resizeHitsForInput ( )

Definition at line 261 of file Track.cc.

References hitsOnTrk_, and mkfit::TrackBase::lastHitIdx_.

261  {
262  bzero(&hitsOnTrk_, sizeof(hitsOnTrk_));
263  hitsOnTrk_.resize(lastHitIdx_ + 1);
264  }
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584
short int lastHitIdx_
Definition: Track.h:346

◆ setHitIdx()

void mkfit::Track::setHitIdx ( int  posHitIdx,
int  newIdx 
)
inline

Definition at line 504 of file Track.h.

References hitsOnTrk_.

504 { hitsOnTrk_[posHitIdx].index = newIdx; }
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584

◆ setHitIdxAtPos()

void mkfit::Track::setHitIdxAtPos ( int  pos,
const HitOnTrack hot 
)
inline

Definition at line 438 of file Track.h.

References hitsOnTrk_.

438 { hitsOnTrk_[pos] = hot; }
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584

◆ setHitIdxLyr()

void mkfit::Track::setHitIdxLyr ( int  posHitIdx,
int  newIdx,
int  newLyr 
)
inline

Definition at line 506 of file Track.h.

References hitsOnTrk_.

506 { hitsOnTrk_[posHitIdx] = {newIdx, newLyr}; }
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584

◆ setNOverlapHits()

void mkfit::Track::setNOverlapHits ( int  n)
inline

◆ sortHitsByLayer()

void mkfit::Track::sortHitsByLayer ( )

Definition at line 266 of file Track.cc.

References hitsOnTrk_, and mkfit::TrackBase::lastHitIdx_.

Referenced by mkfit::StdSeq::clean_cms_seedtracks_iter().

266  {
267  std::stable_sort(&hitsOnTrk_[0], &hitsOnTrk_[lastHitIdx_ + 1], [](const auto& h1, const auto& h2) {
268  return h1.layer < h2.layer;
269  });
270  }
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:584
short int lastHitIdx_
Definition: Track.h:346

◆ swimPhiToR()

float mkfit::Track::swimPhiToR ( const float  x,
const float  y 
) const

Definition at line 272 of file Track.cc.

References funct::abs(), mkfit::TrackBase::charge(), HGC3DClusterGenMatchSelector_cfi::dR, mkfit::getHypot(), mkfit::TrackBase::momPhi(), mkfit::Const::PI, mkfit::TrackBase::pT(), mkfit::squashPhiGeneral(), findQualityFiles::v, mkfit::TrackBase::x(), and mkfit::TrackBase::y().

272  {
273  const float dR = getHypot(x() - x0, y() - y0);
274  // XXX-ASSUMPTION-ERROR can not always reach R, should see what callers expect.
275  // For now return PI to signal apex on the ohter side of the helix.
276  const float v = dR / 176.f / pT() * charge();
277  const float dPhi = std::abs(v) <= 1.0f ? 2.f * std::asin(v) : Const::PI;
278  ;
279  return squashPhiGeneral(momPhi() - dPhi);
280  }
int charge() const
Definition: Track.h:183
float pT() const
Definition: Track.h:169
float squashPhiGeneral(float phi)
Definition: Hit.h:22
float y() const
Definition: Track.h:159
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float getHypot(float x, float y)
Definition: Hit.h:47
float x() const
Definition: Track.h:158
float momPhi() const
Definition: Track.h:172

◆ zAtR()

float mkfit::Track::zAtR ( float  R,
float *  r_reached = nullptr 
) const

Definition at line 297 of file Track.cc.

References mkfit::Config::Bfield, c, mkfit::TrackBase::charge(), funct::cos(), f, mps_fire::i, l1ctLayer2EG_cff::id, mkfit::TrackBase::invpT(), dqmdumpme::k, mkfit::Config::Niter, mkfit::TrackBase::px(), mkfit::TrackBase::py(), mkfit::TrackBase::pz(), dttmaxenums::R, funct::sin(), mkfit::Const::sol, mkfit::TrackBase::x(), mkfit::TrackBase::y(), and mkfit::TrackBase::z().

297  {
298  float xc = x();
299  float yc = y();
300  float pxc = px();
301  float pyc = py();
302 
303  const float ipt = invpT();
304  const float kinv = ((charge() < 0) ? 0.01f : -0.01f) * Const::sol * Config::Bfield;
305  const float k = 1.0f / kinv;
306 
307  const float c = 0.5f * kinv * ipt;
308  const float ooc = 1.0f / c; // 2 * radius of curvature
309  const float lambda = pz() * ipt;
310 
311  //printf("Track::zAtR to R=%f: k=%e, ipt=%e, c=%e, ooc=%e -- can hit = %f (if > 1 can)\n",
312  // R, k, ipt, c, ooc, ooc / (R - std::hypot(xc,yc)));
313 
314  float D = 0;
315 
316  for (int i = 0; i < Config::Niter; ++i) {
317  // compute tangental and ideal distance for the current iteration.
318  // 3-rd order asin for symmetric incidence (shortest arc lenght).
319  float r0 = std::hypot(xc, yc);
320  float td = (R - r0) * c;
321  float id = ooc * td * (1.0f + 0.16666666f * td * td);
322  // This would be for line approximation:
323  // float id = R - r0;
324  D += id;
325 
326  //printf("%-3d r0=%f R-r0=%f td=%f id=%f id_line=%f delta_id=%g\n",
327  // i, r0, R-r0, td, id, R - r0, id - (R-r0));
328 
329  float cosa = std::cos(id * ipt * kinv);
330  float sina = std::sin(id * ipt * kinv);
331 
332  //update parameters
333  xc += k * (pxc * sina - pyc * (1.0f - cosa));
334  yc += k * (pyc * sina + pxc * (1.0f - cosa));
335 
336  const float pxo = pxc; //copy before overwriting
337  pxc = pxc * cosa - pyc * sina;
338  pyc = pyc * cosa + pxo * sina;
339  }
340 
341  if (r_reached)
342  *r_reached = std::hypot(xc, yc);
343 
344  return z() + lambda * D;
345 
346  // ----------------------------------------------------------------
347  // Exact solution from Avery's notes ... loses precision somewhere
348  // {
349  // const float a = kinv;
350  // float pT = S.pT();
351 
352  // float ax2y2 = a*(x*x + y*y);
353  // float T = std::sqrt(pT*pT - 2.0f*a*(x*py - y*px) + a*ax2y2);
354  // float D0 = (T - pT) / a;
355  // float D = (-2.0f * (x*py - y*px) + a * (x*x + y*y)) / (T + pT);
356 
357  // float B = c * std::sqrt((R*R - D*D) / (1.0f + 2.0f*c*D));
358  // float s1 = std::asin(B) / c;
359  // float s2 = (Const::PI - std::asin(B)) / c;
360 
361  // printf("pt %f, invpT %f\n", pT, S.invpT());
362  // printf("lambda %f, a %f, c %f, T %f, D0 %f, D %f, B %f, s1 %f, s2 %f\n",
363  // lambda, a, c, T, D0, D, B, s1, s2);
364  // printf("%f = %f / %f\n", (R*R - D*D) / (1.0f + 2.0f*c*D), (R*R - D*D), (1.0f + 2.0f*c*D));
365 
366  // z1 = S.z() + lambda * s1;
367  // z2 = S.z() + lambda * s2;
368 
369  // printf("z1=%f z2=%f\n", z1, z2);
370  // }
371  // ----------------------------------------------------------------
372  }
int charge() const
Definition: Track.h:183
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
float invpT() const
Definition: Track.h:170
float py() const
Definition: Track.h:167
float y() const
Definition: Track.h:159
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
constexpr float Bfield
Definition: Config.h:88
double f[11][100]
constexpr float sol
Definition: Config.h:48
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141
float z() const
Definition: Track.h:160
float px() const
Definition: Track.h:166
float pz() const
Definition: Track.h:168
float x() const
Definition: Track.h:158
constexpr int Niter
Definition: Config.h:84

Member Data Documentation

◆ hitsOnTrk_

std::vector<HitOnTrack> mkfit::Track::hitsOnTrk_
private