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, const PropagationFlags &pflags, 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
void clearFailFlag ()
 
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 radius (int itrack, int i) const
 
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] {0.0f}
 
MPlexHV m_msPar [Config::nMaxTrkHits] {0.0f}
 
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]
 
MPlexQI m_FailFlag
 
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:102
MPlexLS m_Err[2]
Definition: MkBase.h:101
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,
const PropagationFlags pflags,
int  N_proc 
)

Definition at line 302 of file MkFitter.cc.

References mkfit::MatriplexErrParPackerSlurpIn< T, D >::addInput(), mkfit::MatriplexPackerSlurpIn< D >::addNullInput(), data, mps_fire::i, mkfit::MkBase::iC, cuy::ii, mkfit::MkBase::iP, mkfit::kalmanUpdate(), 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().

304  {
305  // XXXX This has potential issues hits coming from different layers!
306  // Expected to only work reliably with barrel (consecutive layers from 0 -> m_Nhits)
307  // and with hits present on every layer for every track.
308 
309  // Loops over layers and:
310  // a) slurps in hit parameters;
311  // b) propagates and updates tracks
312 
313  for (int ii = 0; ii < m_Nhits; ++ii) {
314  // XXXX Assuming hit index corresponds to layer!
315  MatriplexHitPacker mhp(layersohits[ii].data());
316 
317  for (int i = 0; i < N_proc; ++i) {
318  const int hidx = m_HoTArr[ii](i, 0, 0).index;
319  const int hlyr = m_HoTArr[ii](i, 0, 0).layer;
320 
321  // XXXXMT4K What to do with hidx < 0 ????
322  // This could solve the unbalanced fit.
323  // Or, if the hidx is the "universal" missing hit, it could just work.
324  // Say, hidx = 0 ... grr ... but then we don't know it is missing.
325 
326  if (hidx < 0 || hlyr < 0) {
327  mhp.addNullInput();
328  } else {
329  mhp.addInput(layersohits[hlyr][hidx]);
330  }
331  }
332 
333  mhp.pack(m_msErr[0], m_msPar[0]);
334 
335  propagateTracksToHitR(m_msPar[0], N_proc, pflags);
336 
337  kalmanUpdate(m_Err[iP], m_Par[iP], m_msErr[0], m_msPar[0], m_Err[iC], m_Par[iC], N_proc);
338  }
339  }
static constexpr int iC
Definition: MkBase.h:18
static constexpr int iP
Definition: MkBase.h:19
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:102
MPlexLS m_Err[2]
Definition: MkBase.h:101
MatriplexErrParPackerSlurpIn< Hit, float > MatriplexHitPacker
void propagateTracksToHitR(const MPlexHV &par, const int N_proc, const PropagationFlags &pf, const MPlexQI *noMatEffPtr=nullptr)
Definition: MkBase.h:42
ii
Definition: cuy.py:589
MPlexQHoT m_HoTArr[Config::nMaxTrkHits]
Definition: MkFitter.h:82
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
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(), 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(), HLT_2024v12_cff::seeds, and DiMuonV_cfg::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:103
static constexpr int iC
Definition: MkBase.h:18
MPlexHV m_msPar[Config::nMaxTrkHits]
Definition: MkFitter.h:76
MPlexLV m_Par[2]
Definition: MkBase.h:102
MPlexLS m_Err[2]
Definition: MkBase.h:101
Definition: EPCuts.h:4
MPlexQI m_Label
Definition: MkFitter.h:78
MPlexQHoT m_HoTArr[Config::nMaxTrkHits]
Definition: MkFitter.h:82
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(), 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 DiMuonV_cfg::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:103
static constexpr int iC
Definition: MkBase.h:18
static constexpr int iP
Definition: MkBase.h:19
MPlexLV m_Par[2]
Definition: MkBase.h:102
MPlexLS m_Err[2]
Definition: MkBase.h:101
Definition: EPCuts.h:4
MPlexQI m_Label
Definition: MkFitter.h:78
MPlexQHoT m_HoTArr[Config::nMaxTrkHits]
Definition: MkFitter.h:82
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(), 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 DiMuonV_cfg::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:103
static constexpr int iC
Definition: MkBase.h:18
static constexpr int iP
Definition: MkBase.h:19
MPlexLV m_Par[2]
Definition: MkBase.h:102
MPlexLS m_Err[2]
Definition: MkBase.h:101
Definition: EPCuts.h:4
MPlexQI m_SeedIdx
Definition: MkFitter.h:79
MPlexQI m_Label
Definition: MkFitter.h:78
MPlexQHoT m_HoTArr[Config::nMaxTrkHits]
Definition: MkFitter.h:82
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(), 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 DiMuonV_cfg::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:103
static constexpr int iC
Definition: MkBase.h:18
MPlexHV m_msPar[Config::nMaxTrkHits]
Definition: MkFitter.h:76
MPlexLV m_Par[2]
Definition: MkBase.h:102
MPlexLS m_Err[2]
Definition: MkBase.h:101
Definition: EPCuts.h:4
MPlexQI m_Label
Definition: MkFitter.h:78
MPlexQHoT m_HoTArr[Config::nMaxTrkHits]
Definition: MkFitter.h:82
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(), 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 DiMuonV_cfg::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:103
static constexpr int iC
Definition: MkBase.h:18
MPlexHV m_msPar[Config::nMaxTrkHits]
Definition: MkFitter.h:76
MPlexLV m_Par[2]
Definition: MkBase.h:102
MPlexLS m_Err[2]
Definition: MkBase.h:101
Definition: EPCuts.h:4
MPlexQI m_Label
Definition: MkFitter.h:78
MPlexQHoT m_HoTArr[Config::nMaxTrkHits]
Definition: MkFitter.h:82
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(), 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 DiMuonV_cfg::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:103
static constexpr int iC
Definition: MkBase.h:18
MPlexLV m_Par[2]
Definition: MkBase.h:102
MPlexLS m_Err[2]
Definition: MkBase.h:101
constexpr int nLayers
Definition: Config.h:38
MatriplexErrParPackerSlurpIn< TrackBase, float > MatriplexTrackPacker
MPlexQI m_Label
Definition: MkFitter.h:78
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 mkfit::MkBase::iC, outputTracks(), and DiMuonV_cfg::tracks.

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

◆ outputFittedTracksAndHitIdx()

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

Definition at line 362 of file MkFitter.cc.

References 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 DiMuonV_cfg::tracks.

362  {
363  // Copies last track parameters (updated) into Track objects and up to m_Nhits.
364  // The tracks vector should be resized to allow direct copying.
365 
366  const int iO = outputProp ? iP : iC;
367 
368  int itrack = 0;
369  for (int i = beg; i < end; ++i, ++itrack) {
370  m_Err[iO].copyOut(itrack, tracks[i].errors_nc().Array());
371  m_Par[iO].copyOut(itrack, tracks[i].parameters_nc().Array());
372 
373  tracks[i].setCharge(m_Chg(itrack, 0, 0));
374  tracks[i].setChi2(m_Chi2(itrack, 0, 0));
375  tracks[i].setLabel(m_Label(itrack, 0, 0));
376 
377  // QQQQ Could do resize and std::copy, as in MkFinder::copy_out(), but
378  // we do not know the correct N_found_hits.
379  tracks[i].resetHits();
380  tracks[i].reserveHits(m_Nhits);
381  for (int hi = 0; hi < m_Nhits; ++hi) {
382  tracks[i].addHitIdx(m_HoTArr[hi](itrack, 0, 0), 0.);
383  }
384  }
385  }
MPlexQI m_Chg
Definition: MkBase.h:103
static constexpr int iC
Definition: MkBase.h:18
static constexpr int iP
Definition: MkBase.h:19
MPlexLV m_Par[2]
Definition: MkBase.h:102
MPlexLS m_Err[2]
Definition: MkBase.h:101
Definition: EPCuts.h:4
portabletest::Array Array
MPlexQI m_Label
Definition: MkFitter.h:78
MPlexQHoT m_HoTArr[Config::nMaxTrkHits]
Definition: MkFitter.h:82
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 mkfit::MkBase::iP, outputTracks(), and DiMuonV_cfg::tracks.

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

◆ outputTracks()

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

Definition at line 345 of file MkFitter.cc.

References mps_fire::i, mkfit::MkBase::m_Chg, m_Chi2, mkfit::MkBase::m_Err, m_Label, mkfit::MkBase::m_Par, and DiMuonV_cfg::tracks.

Referenced by outputFittedTracks(), and outputPropagatedTracks().

345  {
346  // Copies last track parameters (updated) into Track objects.
347  // The tracks vector should be resized to allow direct copying.
348 
349  int itrack = 0;
350  for (int i = beg; i < end; ++i, ++itrack) {
351  m_Err[iCP].copyOut(itrack, tracks[i].errors_nc().Array());
352  m_Par[iCP].copyOut(itrack, tracks[i].parameters_nc().Array());
353 
354  tracks[i].setCharge(m_Chg(itrack, 0, 0));
355 
356  // XXXXX chi2 is not set (also not in SMatrix fit, it seems)
357  tracks[i].setChi2(m_Chi2(itrack, 0, 0));
358  tracks[i].setLabel(m_Label(itrack, 0, 0));
359  }
360  }
MPlexQI m_Chg
Definition: MkBase.h:103
MPlexLV m_Par[2]
Definition: MkBase.h:102
MPlexLS m_Err[2]
Definition: MkBase.h:101
portabletest::Array Array
MPlexQI m_Label
Definition: MkFitter.h:78
MPlexQF m_Chi2
Definition: MkFitter.h:73

◆ printPt()

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

Definition at line 23 of file MkFitter.cc.

References Matriplex::hypot(), 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  }
MPlex< T, D1, D2, N > hypot(const MPlex< T, D1, D2, N > &a, const MPlex< T, D1, D2, N > &b)
Definition: Matriplex.h:436
MPlexLV m_Par[2]
Definition: MkBase.h:102
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:101

◆ 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:102

◆ 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::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 DiMuonV_cfg::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:103
static constexpr int iC
Definition: MkBase.h:18
MPlexHV m_msPar[Config::nMaxTrkHits]
Definition: MkFitter.h:76
MPlexLV m_Par[2]
Definition: MkBase.h:102
MPlexLS m_Err[2]
Definition: MkBase.h:101
MatriplexErrParPackerSlurpIn< Hit, float > MatriplexHitPacker
Definition: EPCuts.h:4
MatriplexErrParPackerSlurpIn< TrackBase, float > MatriplexTrackPacker
MPlexQI m_Label
Definition: MkFitter.h:78
MPlexQHoT m_HoTArr[Config::nMaxTrkHits]
Definition: MkFitter.h:82
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
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] {0.0f}
private

◆ m_msPar

MPlexHV mkfit::MkFitter::m_msPar[Config::nMaxTrkHits] {0.0f}
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.