CMS 3D CMS Logo

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

#include <MkFitter.h>

Inheritance diagram for mkfit::MkFitter:
mkfit::MkBase

Public Member Functions

void checkAlignment ()
 
int countInvalidHits (int itrack, int end_hit) const
 
int countInvalidHits (int itrack) const
 
int countValidHits (int itrack, int end_hit) const
 
int countValidHits (int itrack) const
 
void fitTracksWithInterSlurp (const std::vector< HitVec > &layersohits, int N_proc)
 
void inputSeedsTracksAndHits (const std::vector< Track > &seeds, const std::vector< Track > &tracks, const std::vector< HitVec > &layerHits, int beg, int end)
 
void inputTracksAndHitIdx (const std::vector< Track > &tracks, int beg, int end, bool inputProp)
 
void inputTracksAndHitIdx (const std::vector< std::vector< Track > > &tracks, const std::vector< std::pair< int, int > > &idxs, int beg, int end, bool inputProp)
 
void inputTracksAndHits (const std::vector< Track > &tracks, const std::vector< HitVec > &layerHits, int beg, int end)
 
void inputTracksAndHits (const std::vector< Track > &tracks, const std::vector< LayerOfHits > &layerHits, int beg, int end)
 
void inputTracksForFit (const std::vector< Track > &tracks, int beg, int end)
 
 MkFitter ()
 
void outputFittedTracks (std::vector< Track > &tracks, int beg, int end) const
 
void outputFittedTracksAndHitIdx (std::vector< Track > &tracks, int beg, int end, bool outputProp) const
 
void outputPropagatedTracks (std::vector< Track > &tracks, int beg, int end) const
 
void outputTracks (std::vector< Track > &tracks, int beg, int end, int iCP) const
 
void printPt (int idx)
 
MPlexLSrefErr0 ()
 
MPlexLVrefPar0 ()
 
void setNhits (int newnhits)
 
void slurpInTracksAndHits (const std::vector< Track > &tracks, const std::vector< HitVec > &layerHits, int beg, int end)
 
- Public Member Functions inherited from mkfit::MkBase
float getPar (int itrack, int i, int par) const
 
 MkBase ()
 
void propagateTracksToHitR (const MPlexHV &par, const int N_proc, const PropagationFlags pf, const MPlexQI *noMatEffPtr=nullptr)
 
void propagateTracksToHitZ (const MPlexHV &par, const int N_proc, const PropagationFlags pf, const MPlexQI *noMatEffPtr=nullptr)
 
void propagateTracksToPCAZ (const int N_proc, const PropagationFlags pf)
 
void propagateTracksToR (float r, const int N_proc, const PropagationFlags pf)
 
void propagateTracksToZ (float z, const int N_proc, const PropagationFlags pf)
 
float radiusSqr (int itrack, int i) const
 

Private Attributes

MPlexQI m_CandIdx
 
MPlexQF m_Chi2
 
MPlexQHoT m_HoTArr [Config::nMaxTrkHits]
 
MPlexQI m_Label
 
MPlexHS m_msErr [Config::nMaxTrkHits]
 
MPlexHV m_msPar [Config::nMaxTrkHits]
 
int m_Nhits
 
MPlexQI m_SeedIdx
 
MPlexHitIdx m_XHitArr
 
MPlexQI m_XHitSize
 

Additional Inherited Members

- Static Public Attributes inherited from mkfit::MkBase
static constexpr int iC = 0
 
static constexpr int iP = 1
 
- Protected Attributes inherited from mkfit::MkBase
MPlexQI m_Chg
 
MPlexLS m_Err [2]
 
MPlexLV m_Par [2]
 

Detailed Description

Definition at line 16 of file MkFitter.h.

Constructor & Destructor Documentation

◆ MkFitter()

mkfit::MkFitter::MkFitter ( )
inline

Definition at line 18 of file MkFitter.h.

18 : m_Nhits(0) {}

Member Function Documentation

◆ checkAlignment()

void mkfit::MkFitter::checkAlignment ( )

Definition at line 13 of file MkFitter.cc.

References Matriplex::align_check(), mkfit::MkBase::m_Err, m_msErr, m_msPar, and mkfit::MkBase::m_Par.

13  {
14  printf("MkFitter alignment check:\n");
15  Matriplex::align_check(" m_Err[0] =", &m_Err[0].fArray[0]);
16  Matriplex::align_check(" m_Err[1] =", &m_Err[1].fArray[0]);
17  Matriplex::align_check(" m_Par[0] =", &m_Par[0].fArray[0]);
18  Matriplex::align_check(" m_Par[1] =", &m_Par[1].fArray[0]);
19  Matriplex::align_check(" m_msErr[0] =", &m_msErr[0].fArray[0]);
20  Matriplex::align_check(" m_msPar[0] =", &m_msPar[0].fArray[0]);
21  }
MPlexHV m_msPar[Config::nMaxTrkHits]
Definition: MkFitter.h:76
MPlexLV m_Par[2]
Definition: MkBase.h:95
MPlexLS m_Err[2]
Definition: MkBase.h:94
void align_check(const char *pref, void *adr)
MPlexHS m_msErr[Config::nMaxTrkHits]
Definition: MkFitter.h:75

◆ countInvalidHits() [1/2]

int mkfit::MkFitter::countInvalidHits ( int  itrack,
int  end_hit 
) const

Definition at line 38 of file MkFitter.cc.

References m_HoTArr, and mps_fire::result.

38  {
39  int result = 0;
40  for (int hi = 0; hi < end_hit; ++hi) {
41  // XXXX MT: Should also count -2 hits as invalid?
42  if (m_HoTArr[hi](itrack, 0, 0).index == -1)
43  result++;
44  }
45  return result;
46  }
Definition: EPCuts.h:4
MPlexQHoT m_HoTArr[Config::nMaxTrkHits]
Definition: MkFitter.h:82

◆ countInvalidHits() [2/2]

int mkfit::MkFitter::countInvalidHits ( int  itrack) const
inline

Definition at line 35 of file MkFitter.h.

References countInvalidHits(), and m_Nhits.

Referenced by countInvalidHits().

35 { return countInvalidHits(itrack, m_Nhits); }
int countInvalidHits(int itrack, int end_hit) const
Definition: MkFitter.cc:38

◆ countValidHits() [1/2]

int mkfit::MkFitter::countValidHits ( int  itrack,
int  end_hit 
) const

Definition at line 29 of file MkFitter.cc.

References m_HoTArr, and mps_fire::result.

29  {
30  int result = 0;
31  for (int hi = 0; hi < end_hit; ++hi) {
32  if (m_HoTArr[hi](itrack, 0, 0).index >= 0)
33  result++;
34  }
35  return result;
36  }
Definition: EPCuts.h:4
MPlexQHoT m_HoTArr[Config::nMaxTrkHits]
Definition: MkFitter.h:82

◆ countValidHits() [2/2]

int mkfit::MkFitter::countValidHits ( int  itrack) const
inline

Definition at line 34 of file MkFitter.h.

References countValidHits(), and m_Nhits.

Referenced by countValidHits().

34 { return countValidHits(itrack, m_Nhits); }
int countValidHits(int itrack, int end_hit) const
Definition: MkFitter.cc:29

◆ fitTracksWithInterSlurp()

void mkfit::MkFitter::fitTracksWithInterSlurp ( const std::vector< HitVec > &  layersohits,
int  N_proc 
)

Definition at line 302 of file MkFitter.cc.

References mkfit::MatriplexErrParPackerSlurpIn< T, D >::addInput(), mkfit::MatriplexPackerSlurpIn< D >::addNullInput(), data, mkfit::PropagationConfig::get_default(), mps_fire::i, mkfit::MkBase::iC, cuy::ii, mkfit::MkBase::iP, mkfit::kalmanUpdate(), phase1PixelTopology::layer, mkfit::MkBase::m_Err, m_HoTArr, m_msErr, m_msPar, m_Nhits, mkfit::MkBase::m_Par, mkfit::MatriplexErrParPackerSlurpIn< T, D >::pack(), and mkfit::MkBase::propagateTracksToHitR().

302  {
303  // XXXX This has potential issues hits coming from different layers!
304  // Expected to only work reliably with barrel (consecutive layers from 0 -> m_Nhits)
305  // and with hits present on every layer for every track.
306 
307  // Loops over layers and:
308  // a) slurps in hit parameters;
309  // b) propagates and updates tracks
310 
311  for (int ii = 0; ii < m_Nhits; ++ii) {
312  // XXXX Assuming hit index corresponds to layer!
313  MatriplexHitPacker mhp(layersohits[ii].data());
314 
315  for (int i = 0; i < N_proc; ++i) {
316  const int hidx = m_HoTArr[ii](i, 0, 0).index;
317  const int hlyr = m_HoTArr[ii](i, 0, 0).layer;
318 
319  // XXXXMT4K What to do with hidx < 0 ????
320  // This could solve the unbalanced fit.
321  // Or, if the hidx is the "universal" missing hit, it could just work.
322  // Say, hidx = 0 ... grr ... but then we don't know it is missing.
323 
324  if (hidx < 0 || hlyr < 0) {
325  mhp.addNullInput();
326  } else {
327  mhp.addInput(layersohits[hlyr][hidx]);
328  }
329  }
330 
331  mhp.pack(m_msErr[0], m_msPar[0]);
332 
333  propagateTracksToHitR(m_msPar[0], N_proc, PropagationConfig::get_default().forward_fit_pflags);
334 
335  kalmanUpdate(m_Err[iP], m_Par[iP], m_msErr[0], m_msPar[0], m_Err[iC], m_Par[iC], N_proc);
336  }
337  }
static constexpr int iC
Definition: MkBase.h:16
static constexpr int iP
Definition: MkBase.h:17
MPlexHV m_msPar[Config::nMaxTrkHits]
Definition: MkFitter.h:76
void kalmanUpdate(const MPlexLS &psErr, const MPlexLV &psPar, const MPlexHS &msErr, const MPlexHV &msPar, MPlexLS &outErr, MPlexLV &outPar, const int N_proc)
MPlexLV m_Par[2]
Definition: MkBase.h:95
constexpr std::array< uint8_t, layerIndexSize > layer
MPlexLS m_Err[2]
Definition: MkBase.h:94
MatriplexErrParPackerSlurpIn< Hit, float > MatriplexHitPacker
static const PropagationConfig & get_default()
Definition: Config.h:33
void propagateTracksToHitR(const MPlexHV &par, const int N_proc, const PropagationFlags pf, const MPlexQI *noMatEffPtr=nullptr)
Definition: MkBase.h:39
ii
Definition: cuy.py:589
MPlexQHoT m_HoTArr[Config::nMaxTrkHits]
Definition: MkFitter.h:82
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
MPlexHS m_msErr[Config::nMaxTrkHits]
Definition: MkFitter.h:75

◆ inputSeedsTracksAndHits()

void mkfit::MkFitter::inputSeedsTracksAndHits ( const std::vector< Track > &  seeds,
const std::vector< Track > &  tracks,
const std::vector< HitVec > &  layerHits,
int  beg,
int  end 
)

Definition at line 222 of file MkFitter.cc.

References mkfit::TrackBase::charge(), mkfit::TrackBase::chi2(), Matriplex::Matriplex< T, D1, D2, N >::copyIn(), Matriplex::MatriplexSym< T, D, N >::copyIn(), mps_fire::end, mkfit::TrackBase::errors(), mkfit::Track::getHitIdx(), mkfit::Track::getHitOnTrack(), mps_fire::i, mkfit::MkBase::iC, mkfit::TrackBase::label(), mkfit::MkBase::m_Chg, m_Chi2, mkfit::MkBase::m_Err, m_HoTArr, m_Label, m_msErr, m_msPar, m_Nhits, mkfit::MkBase::m_Par, mkfit::TrackBase::parameters(), DetachedQuadStep_cff::seeds, and tracks.

226  {
227  // Assign track parameters to initial state and copy hit values in.
228 
229  // This might not be true for the last chunk!
230  // assert(end - beg == NN);
231 
232  int itrack;
233  for (int i = beg; i < end; ++i) {
234  itrack = i - beg;
235 
236  const Track& see = seeds[i];
237 
238  m_Label(itrack, 0, 0) = see.label();
239  if (see.label() < 0)
240  continue;
241 
242  m_Err[iC].copyIn(itrack, see.errors().Array());
243  m_Par[iC].copyIn(itrack, see.parameters().Array());
244 
245  m_Chg(itrack, 0, 0) = see.charge();
246  m_Chi2(itrack, 0, 0) = see.chi2();
247 
248  const Track& trk = tracks[see.label()];
249 
250  // CopyIn seems fast enough, but indirections are quite slow.
251  for (int hi = 0; hi < m_Nhits; ++hi) {
252  m_HoTArr[hi](itrack, 0, 0) = trk.getHitOnTrack(hi);
253 
254  const int hidx = trk.getHitIdx(hi);
255  if (hidx < 0)
256  continue; //fixme, check if this is harmless
257 
258  const Hit& hit = layerHits[hi][hidx];
259  m_msErr[hi].copyIn(itrack, hit.errArray());
260  m_msPar[hi].copyIn(itrack, hit.posArray());
261  }
262  }
263  }
MPlexQI m_Chg
Definition: MkBase.h:96
static constexpr int iC
Definition: MkBase.h:16
void copyIn(idx_t n, const T *arr)
Definition: Matriplex.h:70
MPlexHV m_msPar[Config::nMaxTrkHits]
Definition: MkFitter.h:76
MPlexLV m_Par[2]
Definition: MkBase.h:95
MPlexLS m_Err[2]
Definition: MkBase.h:94
Definition: EPCuts.h:4
MPlexQI m_Label
Definition: MkFitter.h:78
auto const & tracks
cannot be loose
MPlexQHoT m_HoTArr[Config::nMaxTrkHits]
Definition: MkFitter.h:82
void copyIn(idx_t n, const T *arr)
Definition: MatriplexSym.h:87
MPlexQF m_Chi2
Definition: MkFitter.h:73
MPlexHS m_msErr[Config::nMaxTrkHits]
Definition: MkFitter.h:75

◆ inputTracksAndHitIdx() [1/2]

void mkfit::MkFitter::inputTracksAndHitIdx ( const std::vector< Track > &  tracks,
int  beg,
int  end,
bool  inputProp 
)

Definition at line 165 of file MkFitter.cc.

References mkfit::TrackBase::charge(), mkfit::TrackBase::chi2(), Matriplex::Matriplex< T, D1, D2, N >::copyIn(), Matriplex::MatriplexSym< T, D, N >::copyIn(), mps_fire::end, mkfit::TrackBase::errors(), mkfit::Track::getHitOnTrack(), mps_fire::i, mkfit::MkBase::iC, mkfit::MkBase::iP, mkfit::TrackBase::label(), mkfit::MkBase::m_Chg, m_Chi2, mkfit::MkBase::m_Err, m_HoTArr, m_Label, m_Nhits, mkfit::MkBase::m_Par, mkfit::TrackBase::parameters(), and tracks.

165  {
166  // Assign track parameters to initial state and copy hit values in.
167 
168  // This might not be true for the last chunk!
169  // assert(end - beg == NN);
170 
171  const int iI = inputProp ? iP : iC;
172 
173  int itrack = 0;
174  for (int i = beg; i < end; ++i, ++itrack) {
175  const Track& trk = tracks[i];
176 
177  m_Err[iI].copyIn(itrack, trk.errors().Array());
178  m_Par[iI].copyIn(itrack, trk.parameters().Array());
179 
180  m_Chg(itrack, 0, 0) = trk.charge();
181  m_Chi2(itrack, 0, 0) = trk.chi2();
182  m_Label(itrack, 0, 0) = trk.label();
183 
184  for (int hi = 0; hi < m_Nhits; ++hi) {
185  m_HoTArr[hi](itrack, 0, 0) = trk.getHitOnTrack(hi);
186  }
187  }
188  }
MPlexQI m_Chg
Definition: MkBase.h:96
static constexpr int iC
Definition: MkBase.h:16
static constexpr int iP
Definition: MkBase.h:17
void copyIn(idx_t n, const T *arr)
Definition: Matriplex.h:70
MPlexLV m_Par[2]
Definition: MkBase.h:95
MPlexLS m_Err[2]
Definition: MkBase.h:94
Definition: EPCuts.h:4
MPlexQI m_Label
Definition: MkFitter.h:78
auto const & tracks
cannot be loose
MPlexQHoT m_HoTArr[Config::nMaxTrkHits]
Definition: MkFitter.h:82
void copyIn(idx_t n, const T *arr)
Definition: MatriplexSym.h:87
MPlexQF m_Chi2
Definition: MkFitter.h:73

◆ inputTracksAndHitIdx() [2/2]

void mkfit::MkFitter::inputTracksAndHitIdx ( const std::vector< std::vector< Track > > &  tracks,
const std::vector< std::pair< int, int > > &  idxs,
int  beg,
int  end,
bool  inputProp 
)

Definition at line 190 of file MkFitter.cc.

References mkfit::TrackBase::charge(), mkfit::TrackBase::chi2(), Matriplex::Matriplex< T, D1, D2, N >::copyIn(), Matriplex::MatriplexSym< T, D, N >::copyIn(), mps_fire::end, mkfit::TrackBase::errors(), mkfit::Track::getHitOnTrack(), mps_fire::i, mkfit::MkBase::iC, mkfit::MkBase::iP, mkfit::TrackBase::label(), m_CandIdx, mkfit::MkBase::m_Chg, m_Chi2, mkfit::MkBase::m_Err, m_HoTArr, m_Label, m_Nhits, mkfit::MkBase::m_Par, m_SeedIdx, mkfit::TrackBase::parameters(), and tracks.

194  {
195  // Assign track parameters to initial state and copy hit values in.
196 
197  // This might not be true for the last chunk!
198  // assert(end - beg == NN);
199 
200  const int iI = inputProp ? iP : iC;
201 
202  int itrack = 0;
203  for (int i = beg; i < end; ++i, ++itrack) {
204  const Track& trk = tracks[idxs[i].first][idxs[i].second];
205 
206  m_Label(itrack, 0, 0) = trk.label();
207  m_SeedIdx(itrack, 0, 0) = idxs[i].first;
208  m_CandIdx(itrack, 0, 0) = idxs[i].second;
209 
210  m_Err[iI].copyIn(itrack, trk.errors().Array());
211  m_Par[iI].copyIn(itrack, trk.parameters().Array());
212 
213  m_Chg(itrack, 0, 0) = trk.charge();
214  m_Chi2(itrack, 0, 0) = trk.chi2();
215 
216  for (int hi = 0; hi < m_Nhits; ++hi) {
217  m_HoTArr[hi](itrack, 0, 0) = trk.getHitOnTrack(hi);
218  }
219  }
220  }
MPlexQI m_Chg
Definition: MkBase.h:96
static constexpr int iC
Definition: MkBase.h:16
static constexpr int iP
Definition: MkBase.h:17
void copyIn(idx_t n, const T *arr)
Definition: Matriplex.h:70
MPlexLV m_Par[2]
Definition: MkBase.h:95
MPlexLS m_Err[2]
Definition: MkBase.h:94
Definition: EPCuts.h:4
MPlexQI m_SeedIdx
Definition: MkFitter.h:79
MPlexQI m_Label
Definition: MkFitter.h:78
auto const & tracks
cannot be loose
MPlexQHoT m_HoTArr[Config::nMaxTrkHits]
Definition: MkFitter.h:82
void copyIn(idx_t n, const T *arr)
Definition: MatriplexSym.h:87
MPlexQF m_Chi2
Definition: MkFitter.h:73
MPlexQI m_CandIdx
Definition: MkFitter.h:80

◆ inputTracksAndHits() [1/2]

void mkfit::MkFitter::inputTracksAndHits ( const std::vector< Track > &  tracks,
const std::vector< HitVec > &  layerHits,
int  beg,
int  end 
)

Definition at line 50 of file MkFitter.cc.

References mkfit::TrackBase::charge(), mkfit::TrackBase::chi2(), Matriplex::Matriplex< T, D1, D2, N >::copyIn(), Matriplex::MatriplexSym< T, D, N >::copyIn(), mps_fire::end, mkfit::TrackBase::errors(), mkfit::Track::getHitIdx(), mkfit::Track::getHitOnTrack(), mps_fire::i, mkfit::MkBase::iC, mkfit::TrackBase::label(), mkfit::MkBase::m_Chg, m_Chi2, mkfit::MkBase::m_Err, m_HoTArr, m_Label, m_msErr, m_msPar, m_Nhits, mkfit::MkBase::m_Par, mkfit::TrackBase::parameters(), and tracks.

53  {
54  // Assign track parameters to initial state and copy hit values in.
55 
56  // This might not be true for the last chunk!
57  // assert(end - beg == NN);
58 
59  int itrack = 0;
60 
61  for (int i = beg; i < end; ++i, ++itrack) {
62  const Track& trk = tracks[i];
63 
64  m_Err[iC].copyIn(itrack, trk.errors().Array());
65  m_Par[iC].copyIn(itrack, trk.parameters().Array());
66 
67  m_Chg(itrack, 0, 0) = trk.charge();
68  m_Chi2(itrack, 0, 0) = trk.chi2();
69  m_Label(itrack, 0, 0) = trk.label();
70 
71  // CopyIn seems fast enough, but indirections are quite slow.
72  for (int hi = 0; hi < m_Nhits; ++hi) {
73  m_HoTArr[hi](itrack, 0, 0) = trk.getHitOnTrack(hi);
74 
75  const int hidx = trk.getHitIdx(hi);
76  if (hidx < 0)
77  continue;
78 
79  const Hit& hit = layerHits[hi][hidx];
80  m_msErr[hi].copyIn(itrack, hit.errArray());
81  m_msPar[hi].copyIn(itrack, hit.posArray());
82  }
83  }
84  }
MPlexQI m_Chg
Definition: MkBase.h:96
static constexpr int iC
Definition: MkBase.h:16
void copyIn(idx_t n, const T *arr)
Definition: Matriplex.h:70
MPlexHV m_msPar[Config::nMaxTrkHits]
Definition: MkFitter.h:76
MPlexLV m_Par[2]
Definition: MkBase.h:95
MPlexLS m_Err[2]
Definition: MkBase.h:94
Definition: EPCuts.h:4
MPlexQI m_Label
Definition: MkFitter.h:78
auto const & tracks
cannot be loose
MPlexQHoT m_HoTArr[Config::nMaxTrkHits]
Definition: MkFitter.h:82
void copyIn(idx_t n, const T *arr)
Definition: MatriplexSym.h:87
MPlexQF m_Chi2
Definition: MkFitter.h:73
MPlexHS m_msErr[Config::nMaxTrkHits]
Definition: MkFitter.h:75

◆ inputTracksAndHits() [2/2]

void mkfit::MkFitter::inputTracksAndHits ( const std::vector< Track > &  tracks,
const std::vector< LayerOfHits > &  layerHits,
int  beg,
int  end 
)

Definition at line 86 of file MkFitter.cc.

References mkfit::TrackBase::charge(), mkfit::TrackBase::chi2(), Matriplex::Matriplex< T, D1, D2, N >::copyIn(), Matriplex::MatriplexSym< T, D, N >::copyIn(), mps_fire::end, mkfit::TrackBase::errors(), mkfit::Track::getHitIdx(), mkfit::Track::getHitLyr(), mkfit::Track::getHitOnTrack(), mps_fire::i, mkfit::MkBase::iC, mkfit::TrackBase::label(), mkfit::MkBase::m_Chg, m_Chi2, mkfit::MkBase::m_Err, m_HoTArr, m_Label, m_msErr, m_msPar, m_Nhits, mkfit::MkBase::m_Par, mkfit::TrackBase::parameters(), and tracks.

89  {
90  // Assign track parameters to initial state and copy hit values in.
91 
92  // This might not be true for the last chunk!
93  // assert(end - beg == NN);
94 
95  int itrack;
96 
97  for (int i = beg; i < end; ++i) {
98  itrack = i - beg;
99  const Track& trk = tracks[i];
100 
101  m_Label(itrack, 0, 0) = trk.label();
102 
103  m_Err[iC].copyIn(itrack, trk.errors().Array());
104  m_Par[iC].copyIn(itrack, trk.parameters().Array());
105 
106  m_Chg(itrack, 0, 0) = trk.charge();
107  m_Chi2(itrack, 0, 0) = trk.chi2();
108 
109  // CopyIn seems fast enough, but indirections are quite slow.
110  for (int hi = 0; hi < m_Nhits; ++hi) {
111  const int hidx = trk.getHitIdx(hi);
112  const int hlyr = trk.getHitLyr(hi);
113  const Hit& hit = layerHits[hlyr].refHit(hidx);
114 
115  m_msErr[hi].copyIn(itrack, hit.errArray());
116  m_msPar[hi].copyIn(itrack, hit.posArray());
117 
118  m_HoTArr[hi](itrack, 0, 0) = trk.getHitOnTrack(hi);
119  }
120  }
121  }
MPlexQI m_Chg
Definition: MkBase.h:96
static constexpr int iC
Definition: MkBase.h:16
void copyIn(idx_t n, const T *arr)
Definition: Matriplex.h:70
MPlexHV m_msPar[Config::nMaxTrkHits]
Definition: MkFitter.h:76
MPlexLV m_Par[2]
Definition: MkBase.h:95
MPlexLS m_Err[2]
Definition: MkBase.h:94
Definition: EPCuts.h:4
MPlexQI m_Label
Definition: MkFitter.h:78
auto const & tracks
cannot be loose
MPlexQHoT m_HoTArr[Config::nMaxTrkHits]
Definition: MkFitter.h:82
void copyIn(idx_t n, const T *arr)
Definition: MatriplexSym.h:87
MPlexQF m_Chi2
Definition: MkFitter.h:73
MPlexHS m_msErr[Config::nMaxTrkHits]
Definition: MkFitter.h:75

◆ inputTracksForFit()

void mkfit::MkFitter::inputTracksForFit ( const std::vector< Track > &  tracks,
int  beg,
int  end 
)

Definition at line 269 of file MkFitter.cc.

References mkfit::MatriplexPackerSlurpIn< D >::addInput(), mkfit::MatriplexErrParPackerSlurpIn< T, D >::addInput(), mkfit::TrackBase::charge(), mkfit::TrackBase::chi2(), mps_fire::end, mkfit::Track::getHitsOnTrackArray(), mps_fire::i, mkfit::MkBase::iC, mkfit::TrackBase::label(), mkfit::MkBase::m_Chg, m_Chi2, mkfit::MkBase::m_Err, m_HoTArr, m_Label, mkfit::MkBase::m_Par, mkfit::Config::nLayers, mkfit::MatriplexPackerSlurpIn< D >::pack(), mkfit::MatriplexErrParPackerSlurpIn< T, D >::pack(), and tracks.

269  {
270  // Loads track parameters and hit indices.
271 
272  // XXXXMT4K has Config::nLayers: How many hits do we read in?
273  // Check for max? Expect an argument?
274  // What to do with invalid hits? Skip?
275 
276  // XXXX MT Here the same idx array WAS used for slurping in of tracks and
277  // hots. With this, two index arrays are built, one within each packer.
278 
279  MatriplexTrackPacker mtp(&tracks[beg]);
280  MatriplexHoTPacker mhotp(tracks[beg].getHitsOnTrackArray());
281 
282  int itrack = 0;
283 
284  for (int i = beg; i < end; ++i, ++itrack) {
285  const Track& trk = tracks[i];
286 
287  m_Chg(itrack, 0, 0) = trk.charge();
288  m_Chi2(itrack, 0, 0) = trk.chi2();
289  m_Label(itrack, 0, 0) = trk.label();
290 
291  mtp.addInput(trk);
292 
293  mhotp.addInput(*trk.getHitsOnTrackArray());
294  }
295 
296  mtp.pack(m_Err[iC], m_Par[iC]);
297  for (int ll = 0; ll < Config::nLayers; ++ll) {
298  mhotp.pack(m_HoTArr[ll], ll);
299  }
300  }
MPlexQI m_Chg
Definition: MkBase.h:96
static constexpr int iC
Definition: MkBase.h:16
MPlexLV m_Par[2]
Definition: MkBase.h:95
MPlexLS m_Err[2]
Definition: MkBase.h:94
constexpr int nLayers
Definition: Config.h:73
MatriplexErrParPackerSlurpIn< TrackBase, float > MatriplexTrackPacker
MPlexQI m_Label
Definition: MkFitter.h:78
auto const & tracks
cannot be loose
MatriplexPackerSlurpIn< HitOnTrack > MatriplexHoTPacker
MPlexQHoT m_HoTArr[Config::nMaxTrkHits]
Definition: MkFitter.h:82
MPlexQF m_Chi2
Definition: MkFitter.h:73

◆ outputFittedTracks()

void mkfit::MkFitter::outputFittedTracks ( std::vector< Track > &  tracks,
int  beg,
int  end 
) const
inline

Definition at line 60 of file MkFitter.h.

References mps_fire::end, mkfit::MkBase::iC, outputTracks(), and tracks.

60  {
61  return outputTracks(tracks, beg, end, iC);
62  }
static constexpr int iC
Definition: MkBase.h:16
void outputTracks(std::vector< Track > &tracks, int beg, int end, int iCP) const
Definition: MkFitter.cc:343
auto const & tracks
cannot be loose

◆ outputFittedTracksAndHitIdx()

void mkfit::MkFitter::outputFittedTracksAndHitIdx ( std::vector< Track > &  tracks,
int  beg,
int  end,
bool  outputProp 
) const

Definition at line 360 of file MkFitter.cc.

References Matriplex::Matriplex< T, D1, D2, N >::copyOut(), Matriplex::MatriplexSym< T, D, N >::copyOut(), mps_fire::end, mps_fire::i, mkfit::MkBase::iC, mkfit::MkBase::iP, mkfit::MkBase::m_Chg, m_Chi2, mkfit::MkBase::m_Err, m_HoTArr, m_Label, m_Nhits, mkfit::MkBase::m_Par, and tracks.

360  {
361  // Copies last track parameters (updated) into Track objects and up to m_Nhits.
362  // The tracks vector should be resized to allow direct copying.
363 
364  const int iO = outputProp ? iP : iC;
365 
366  int itrack = 0;
367  for (int i = beg; i < end; ++i, ++itrack) {
368  m_Err[iO].copyOut(itrack, tracks[i].errors_nc().Array());
369  m_Par[iO].copyOut(itrack, tracks[i].parameters_nc().Array());
370 
371  tracks[i].setCharge(m_Chg(itrack, 0, 0));
372  tracks[i].setChi2(m_Chi2(itrack, 0, 0));
373  tracks[i].setLabel(m_Label(itrack, 0, 0));
374 
375  // QQQQ Could do resize and std::copy, as in MkFinder::copy_out(), but
376  // we do not know the correct N_found_hits.
377  tracks[i].resetHits();
378  tracks[i].reserveHits(m_Nhits);
379  for (int hi = 0; hi < m_Nhits; ++hi) {
380  tracks[i].addHitIdx(m_HoTArr[hi](itrack, 0, 0), 0.);
381  }
382  }
383  }
MPlexQI m_Chg
Definition: MkBase.h:96
static constexpr int iC
Definition: MkBase.h:16
static constexpr int iP
Definition: MkBase.h:17
MPlexLV m_Par[2]
Definition: MkBase.h:95
MPlexLS m_Err[2]
Definition: MkBase.h:94
Definition: EPCuts.h:4
void copyOut(idx_t n, T *arr) const
Definition: MatriplexSym.h:195
MPlexQI m_Label
Definition: MkFitter.h:78
auto const & tracks
cannot be loose
MPlexQHoT m_HoTArr[Config::nMaxTrkHits]
Definition: MkFitter.h:82
void copyOut(idx_t n, T *arr) const
Definition: Matriplex.h:180
MPlexQF m_Chi2
Definition: MkFitter.h:73

◆ outputPropagatedTracks()

void mkfit::MkFitter::outputPropagatedTracks ( std::vector< Track > &  tracks,
int  beg,
int  end 
) const
inline

Definition at line 64 of file MkFitter.h.

References mps_fire::end, mkfit::MkBase::iP, outputTracks(), and tracks.

64  {
65  return outputTracks(tracks, beg, end, iP);
66  }
static constexpr int iP
Definition: MkBase.h:17
void outputTracks(std::vector< Track > &tracks, int beg, int end, int iCP) const
Definition: MkFitter.cc:343
auto const & tracks
cannot be loose

◆ outputTracks()

void mkfit::MkFitter::outputTracks ( std::vector< Track > &  tracks,
int  beg,
int  end,
int  iCP 
) const

Definition at line 343 of file MkFitter.cc.

References Matriplex::Matriplex< T, D1, D2, N >::copyOut(), Matriplex::MatriplexSym< T, D, N >::copyOut(), mps_fire::end, mps_fire::i, mkfit::MkBase::m_Chg, m_Chi2, mkfit::MkBase::m_Err, m_Label, mkfit::MkBase::m_Par, and tracks.

Referenced by outputFittedTracks(), and outputPropagatedTracks().

343  {
344  // Copies last track parameters (updated) into Track objects.
345  // The tracks vector should be resized to allow direct copying.
346 
347  int itrack = 0;
348  for (int i = beg; i < end; ++i, ++itrack) {
349  m_Err[iCP].copyOut(itrack, tracks[i].errors_nc().Array());
350  m_Par[iCP].copyOut(itrack, tracks[i].parameters_nc().Array());
351 
352  tracks[i].setCharge(m_Chg(itrack, 0, 0));
353 
354  // XXXXX chi2 is not set (also not in SMatrix fit, it seems)
355  tracks[i].setChi2(m_Chi2(itrack, 0, 0));
356  tracks[i].setLabel(m_Label(itrack, 0, 0));
357  }
358  }
MPlexQI m_Chg
Definition: MkBase.h:96
MPlexLV m_Par[2]
Definition: MkBase.h:95
MPlexLS m_Err[2]
Definition: MkBase.h:94
void copyOut(idx_t n, T *arr) const
Definition: MatriplexSym.h:195
MPlexQI m_Label
Definition: MkFitter.h:78
auto const & tracks
cannot be loose
void copyOut(idx_t n, T *arr) const
Definition: Matriplex.h:180
MPlexQF m_Chi2
Definition: MkFitter.h:73

◆ printPt()

void mkfit::MkFitter::printPt ( int  idx)

Definition at line 23 of file MkFitter.cc.

References mps_fire::i, heavyIonCSV_trainingSettings::idx, mkfit::MkBase::m_Par, and mkfit::NN.

23  {
24  for (int i = 0; i < NN; ++i) {
25  printf("%5.2f ", std::hypot(m_Par[idx].At(i, 3, 0), m_Par[idx].At(i, 4, 0)));
26  }
27  }
MPlexLV m_Par[2]
Definition: MkBase.h:95
constexpr Matriplex::idx_t NN
Definition: Matrix.h:43

◆ refErr0()

MPlexLS& mkfit::MkFitter::refErr0 ( )
inline

Definition at line 21 of file MkFitter.h.

References mkfit::MkBase::m_Err.

21 { return m_Err[0]; }
MPlexLS m_Err[2]
Definition: MkBase.h:94

◆ refPar0()

MPlexLV& mkfit::MkFitter::refPar0 ( )
inline

Definition at line 22 of file MkFitter.h.

References mkfit::MkBase::m_Par.

22 { return m_Par[0]; }
MPlexLV m_Par[2]
Definition: MkBase.h:95

◆ setNhits()

void mkfit::MkFitter::setNhits ( int  newnhits)
inline

Definition at line 30 of file MkFitter.h.

References m_Nhits, SiStripPI::min, and mkfit::Config::nMaxTrkHits.

◆ slurpInTracksAndHits()

void mkfit::MkFitter::slurpInTracksAndHits ( const std::vector< Track > &  tracks,
const std::vector< HitVec > &  layerHits,
int  beg,
int  end 
)

Definition at line 123 of file MkFitter.cc.

References mkfit::MatriplexErrParPackerSlurpIn< T, D >::addInput(), mkfit::TrackBase::charge(), mkfit::TrackBase::chi2(), data, mps_fire::end, mps_fire::i, mkfit::MkBase::iC, mkfit::TrackBase::label(), mkfit::MkBase::m_Chg, m_Chi2, mkfit::MkBase::m_Err, m_HoTArr, m_Label, m_msErr, m_msPar, m_Nhits, mkfit::MkBase::m_Par, mkfit::MatriplexErrParPackerSlurpIn< T, D >::pack(), and tracks.

126  {
127  // Assign track parameters to initial state and copy hit values in.
128 
129  // This might not be true for the last chunk!
130  // assert(end - beg == NN);
131 
132  MatriplexTrackPacker mtp(&tracks[beg]);
133 
134  for (int i = beg; i < end; ++i) {
135  int itrack = i - beg;
136  const Track& trk = tracks[i];
137 
138  m_Label(itrack, 0, 0) = trk.label();
139 
140  mtp.addInput(trk);
141 
142  m_Chg(itrack, 0, 0) = trk.charge();
143  m_Chi2(itrack, 0, 0) = trk.chi2();
144  }
145 
146  mtp.pack(m_Err[iC], m_Par[iC]);
147 
148  // CopyIn seems fast enough, but indirections are quite slow.
149  for (int hi = 0; hi < m_Nhits; ++hi) {
150  MatriplexHitPacker mhp(layerHits[hi].data());
151 
152  for (int i = beg; i < end; ++i) {
153  const int hidx = tracks[i].getHitIdx(hi);
154  const Hit& hit = layerHits[hi][hidx];
155 
156  m_HoTArr[hi](i - beg, 0, 0) = tracks[i].getHitOnTrack(hi);
157 
158  mhp.addInput(hit);
159  }
160 
161  mhp.pack(m_msErr[hi], m_msPar[hi]);
162  }
163  }
MPlexQI m_Chg
Definition: MkBase.h:96
static constexpr int iC
Definition: MkBase.h:16
MPlexHV m_msPar[Config::nMaxTrkHits]
Definition: MkFitter.h:76
MPlexLV m_Par[2]
Definition: MkBase.h:95
MPlexLS m_Err[2]
Definition: MkBase.h:94
MatriplexErrParPackerSlurpIn< Hit, float > MatriplexHitPacker
Definition: EPCuts.h:4
MatriplexErrParPackerSlurpIn< TrackBase, float > MatriplexTrackPacker
MPlexQI m_Label
Definition: MkFitter.h:78
auto const & tracks
cannot be loose
MPlexQHoT m_HoTArr[Config::nMaxTrkHits]
Definition: MkFitter.h:82
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
MPlexQF m_Chi2
Definition: MkFitter.h:73
MPlexHS m_msErr[Config::nMaxTrkHits]
Definition: MkFitter.h:75

Member Data Documentation

◆ m_CandIdx

MPlexQI mkfit::MkFitter::m_CandIdx
private

Definition at line 80 of file MkFitter.h.

Referenced by inputTracksAndHitIdx().

◆ m_Chi2

MPlexQF mkfit::MkFitter::m_Chi2
private

◆ m_HoTArr

MPlexQHoT mkfit::MkFitter::m_HoTArr[Config::nMaxTrkHits]
private

◆ m_Label

MPlexQI mkfit::MkFitter::m_Label
private

◆ m_msErr

MPlexHS mkfit::MkFitter::m_msErr[Config::nMaxTrkHits]
private

◆ m_msPar

MPlexHV mkfit::MkFitter::m_msPar[Config::nMaxTrkHits]
private

◆ m_Nhits

int mkfit::MkFitter::m_Nhits
private

◆ m_SeedIdx

MPlexQI mkfit::MkFitter::m_SeedIdx
private

Definition at line 79 of file MkFitter.h.

Referenced by inputTracksAndHitIdx().

◆ m_XHitArr

MPlexHitIdx mkfit::MkFitter::m_XHitArr
private

Definition at line 86 of file MkFitter.h.

◆ m_XHitSize

MPlexQI mkfit::MkFitter::m_XHitSize
private

Definition at line 85 of file MkFitter.h.