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 367 of file Track.h.

Constructor & Destructor Documentation

◆ Track() [1/5]

mkfit::Track::Track ( )
inline

Definition at line 369 of file Track.h.

369 {}

◆ Track() [2/5]

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

Definition at line 371 of file Track.h.

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

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

◆ Track() [3/5]

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

Definition at line 377 of file Track.h.

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

378  : TrackBase(state, chi2, label) {
380  for (int h = 0; h < nHits; ++h) {
381  addHitIdx(hits[h].index, hits[h].layer, 0.0f);
382  }
383  }
float chi2() const
Definition: Track.h:186
int label() const
Definition: Track.h:188
void reserveHits(int nHits)
Definition: Track.h:425
double f[11][100]
void addHitIdx(int hitIdx, int hitLyr, float chi2)
Definition: Track.h:444
const TrackState & state() const
Definition: Track.h:143
TupleMultiplicity< TrackerTraits > const *__restrict__ uint32_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 385 of file Track.h.

int charge() const
Definition: Track.h:185
float chi2() const
Definition: Track.h:186
SVector3 momentum() const
Definition: Track.h:158
SVector3 position() const
Definition: Track.h:157
Definition: errors.py:1

◆ Track() [5/5]

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

Definition at line 388 of file Track.h.

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

Member Function Documentation

◆ addHitIdx() [1/2]

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

Definition at line 444 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().

444  {
445  hitsOnTrk_.push_back({hitIdx, hitLyr});
446  ++lastHitIdx_;
447  if (hitIdx >= 0 || hitIdx == -9) {
448  ++nFoundHits_;
449  chi2_ += chi2;
450  }
451  }
float chi2_
Definition: Track.h:346
float chi2() const
Definition: Track.h:186
short int nFoundHits_
Definition: Track.h:349
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:586
short int lastHitIdx_
Definition: Track.h:348

◆ addHitIdx() [2/2]

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

Definition at line 453 of file Track.h.

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

Referenced by addHitIdx().

453 { addHitIdx(hot.index, hot.layer, chi2); }
float chi2() const
Definition: Track.h:186
void addHitIdx(int hitIdx, int hitLyr, float chi2)
Definition: Track.h:444

◆ beginHitsOnTrack()

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

Definition at line 501 of file Track.h.

References hitsOnTrk_.

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

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

◆ beginHitsOnTrack_nc()

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

Definition at line 504 of file Track.h.

References hitsOnTrk_.

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

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

◆ canReachRadius()

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

Definition at line 283 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().

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

◆ countAndSetNFoundHits()

void mkfit::Track::countAndSetNFoundHits ( )
inline

Definition at line 510 of file Track.h.

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

510  {
511  nFoundHits_ = 0;
512  for (int i = 0; i <= lastHitIdx_; i++) {
513  if (hitsOnTrk_[i].index >= 0 || hitsOnTrk_[i].index == -9)
514  nFoundHits_++;
515  }
516  }
short int nFoundHits_
Definition: Track.h:349
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:586
short int lastHitIdx_
Definition: Track.h:348

◆ endHitsOnTrack()

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

Definition at line 502 of file Track.h.

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

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

502 { return hitsOnTrk_.data() + (lastHitIdx_ + 1); }
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:586
short int lastHitIdx_
Definition: Track.h:348

◆ foundLayers()

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

Definition at line 575 of file Track.h.

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

575  {
576  std::vector<int> layers;
577  for (int ihit = 0; ihit <= lastHitIdx_; ++ihit) {
578  if (hitsOnTrk_[ihit].index >= 0 || hitsOnTrk_[ihit].index == -9) {
579  layers.push_back(hitsOnTrk_[ihit].layer);
580  }
581  }
582  return layers;
583  }
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:586
short int lastHitIdx_
Definition: Track.h:348

◆ 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

◆ getHitsOnTrackArray()

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

Definition at line 500 of file Track.h.

References hitsOnTrk_.

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

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

◆ getLastFoundHitIdx()

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

Definition at line 475 of file Track.h.

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

475  {
476  int p = getLastFoundHitPos();
477  return p >= 0 ? hitsOnTrk_[p].index : -1;
478  }
float p() const
Definition: Track.h:173
int getLastFoundHitPos() const
Definition: Track.h:464
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:586

◆ getLastFoundHitLyr()

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

Definition at line 479 of file Track.h.

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

479  {
480  int p = getLastFoundHitPos();
481  return p >= 0 ? hitsOnTrk_[p].layer : -1;
482  }
float p() const
Definition: Track.h:173
int getLastFoundHitPos() const
Definition: Track.h:464
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:586

◆ getLastFoundHitOnTrack()

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

Definition at line 471 of file Track.h.

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

Referenced by getLastFoundMCHitID().

471  {
472  int p = getLastFoundHitPos();
473  return p >= 0 ? hitsOnTrk_[p] : HitOnTrack(-1, -1);
474  }
float p() const
Definition: Track.h:173
int getLastFoundHitPos() const
Definition: Track.h:464
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:586

◆ getLastFoundHitPos()

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

Definition at line 464 of file Track.h.

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

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

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

◆ getLastFoundMCHitID()

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

Definition at line 484 of file Track.h.

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

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

◆ getLastHitIdx()

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

Definition at line 461 of file Track.h.

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

461 { return hitsOnTrk_[lastHitIdx_].index; }
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:586
short int lastHitIdx_
Definition: Track.h:348

◆ getLastHitLyr()

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

Definition at line 462 of file Track.h.

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

462 { return hitsOnTrk_[lastHitIdx_].layer; }
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:586
short int lastHitIdx_
Definition: Track.h:348

◆ getLastHitOnTrack()

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

Definition at line 460 of file Track.h.

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

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

◆ getMCHitIDFromLayer()

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

Definition at line 489 of file Track.h.

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

489  {
490  int mcHitID = -1;
491  for (int ihit = 0; ihit <= lastHitIdx_; ++ihit) {
492  if (hitsOnTrk_[ihit].layer == layer) {
493  mcHitID = globalHitVec[hitsOnTrk_[ihit].layer][hitsOnTrk_[ihit].index].mcHitID();
494  break;
495  }
496  }
497  return mcHitID;
498  }
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:586
short int lastHitIdx_
Definition: Track.h:348

◆ hitsVector()

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

Definition at line 399 of file Track.h.

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

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

◆ maxReachRadius()

float mkfit::Track::maxReachRadius ( ) const

Definition at line 289 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().

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

◆ mcHitIDsVec()

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

Definition at line 410 of file Track.h.

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

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

◆ nFoundHits()

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

◆ nInsideMinusOneHits()

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

Definition at line 524 of file Track.h.

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

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

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

◆ nOverlapHits()

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

Definition at line 521 of file Track.h.

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

Referenced by mkfit::getScoreCand().

521 { return status_.n_overlaps; }
Status status_
Definition: Track.h:350

◆ nTailMinusOneHits()

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

Definition at line 536 of file Track.h.

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

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

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

◆ nTotalHits()

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

◆ nUniqueLayers()

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

Definition at line 547 of file Track.h.

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

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

◆ rAtZ()

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

Definition at line 375 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().

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

◆ reserveHits()

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

Definition at line 425 of file Track.h.

References hitsOnTrk_, and nHits.

Referenced by Track().

425 { hitsOnTrk_.reserve(nHits); }
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:586
TupleMultiplicity< TrackerTraits > const *__restrict__ uint32_t nHits

◆ resetHits()

void mkfit::Track::resetHits ( )
inline

Definition at line 427 of file Track.h.

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

427  {
428  lastHitIdx_ = -1;
429  nFoundHits_ = 0;
430  hitsOnTrk_.clear();
431  }
short int nFoundHits_
Definition: Track.h:349
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:586
short int lastHitIdx_
Definition: Track.h:348

◆ resizeHits()

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

Definition at line 434 of file Track.h.

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

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

434  {
435  hitsOnTrk_.resize(nHits);
436  lastHitIdx_ = nHits - 1;
438  }
int nFoundHits() const
Definition: Track.h:518
short int nFoundHits_
Definition: Track.h:349
std::vector< HitOnTrack > hitsOnTrk_
Definition: Track.h:586
short int lastHitIdx_
Definition: Track.h:348
TupleMultiplicity< TrackerTraits > const *__restrict__ uint32_t nHits

◆ resizeHitsForInput()

void mkfit::Track::resizeHitsForInput ( )

Definition at line 262 of file Track.cc.

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

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

◆ setHitIdx()

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

Definition at line 506 of file Track.h.

References hitsOnTrk_.

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

◆ setHitIdxAtPos()

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

Definition at line 440 of file Track.h.

References hitsOnTrk_.

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

◆ setHitIdxLyr()

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

Definition at line 508 of file Track.h.

References hitsOnTrk_.

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

◆ setNOverlapHits()

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

◆ sortHitsByLayer()

void mkfit::Track::sortHitsByLayer ( )

Definition at line 267 of file Track.cc.

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

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

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

◆ swimPhiToR()

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

Definition at line 273 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().

273  {
274  const float dR = getHypot(x() - x0, y() - y0);
275  // XXX-ASSUMPTION-ERROR can not always reach R, should see what callers expect.
276  // For now return PI to signal apex on the ohter side of the helix.
277  const float v = dR / 176.f / pT() * charge();
278  const float dPhi = std::abs(v) <= 1.0f ? 2.f * std::asin(v) : Const::PI;
279  ;
280  return squashPhiGeneral(momPhi() - dPhi);
281  }
int charge() const
Definition: Track.h:185
float pT() const
Definition: Track.h:171
float squashPhiGeneral(float phi)
Definition: Hit.h:22
float y() const
Definition: Track.h:161
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:160
float momPhi() const
Definition: Track.h:174

◆ zAtR()

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

Definition at line 298 of file Track.cc.

References mkfit::Config::Bfield, HltBtagPostValidation_cff::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().

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

Member Data Documentation

◆ hitsOnTrk_

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