CMS 3D CMS Logo

Classes | Functions
mkfit::StdSeq Namespace Reference

Classes

struct  Quality
 

Functions

int clean_cms_seedtracks_iter (TrackVec *seed_ptr, const IterationConfig &itrcfg, const BeamSpot &bspot)
 
void cmssw_LoadHits_Begin (EventOfHits &eoh, const std::vector< const HitVec *> &orig_hitvectors)
 
void cmssw_LoadHits_End (EventOfHits &eoh)
 
void cmssw_Map_TrackHitIndices (const EventOfHits &eoh, TrackVec &seeds)
 
void cmssw_ReMap_TrackHitIndices (const EventOfHits &eoh, TrackVec &out_tracks)
 
void dump_simtracks (Event *event)
 
void find_and_remove_duplicates (TrackVec &tracks, const IterationConfig &itconf)
 
void find_duplicates (TrackVec &tracks)
 
void find_duplicates_sharedhits (TrackVec &tracks, const float fraction)
 
void find_duplicates_sharedhits_pixelseed (TrackVec &tracks, const float fraction, const float drth_central, const float drth_obarrel, const float drth_forward)
 
void handle_duplicates (Event *event)
 
void loadDeads (EventOfHits &eoh, const std::vector< DeadVec > &deadvectors)
 
void loadHitsAndBeamSpot (Event &ev, EventOfHits &eoh)
 
void prep_cmsswtracks (Event *event)
 
void prep_recotracks (Event *event)
 
void prep_reftracks (Event *event, TrackVec &tracks, TrackExtraVec &extras, const bool realigntracks)
 
void prep_simtracks (Event *event)
 
void prep_tracks (Event *event, TrackVec &tracks, TrackExtraVec &extras, const bool realigntracks)
 
template<class TRACK >
bool qfilter_n_hits (const TRACK &t, int nMinHits)
 
template<class TRACK >
bool qfilter_n_hits_pixseed (const TRACK &t, int nMinHits)
 
template<class TRACK >
bool qfilter_n_layers (const TRACK &t, const BeamSpot &bspot, const TrackerInfo &trk_inf)
 
template<class TRACK >
bool qfilter_nan_n_silly (const TRACK &t)
 
template<class TRACK >
bool qfilter_pixelLessBkwd (const TRACK &t, const BeamSpot &bspot, const TrackerInfo &tk_info)
 quality filter tuned for pixelLess iteration during backward search More...
 
template<class TRACK >
bool qfilter_pixelLessFwd (const TRACK &t, const BeamSpot &bspot, const TrackerInfo &tk_info)
 quality filter tuned for pixelLess iteration during forward search More...
 
void remove_duplicates (TrackVec &tracks)
 
void root_val (Event *event)
 
void root_val_dumb_cmssw (Event *event)
 
void score_tracks (TrackVec &tracks)
 
void track_print (Event *event, const Track &t, const char *pref)
 

Function Documentation

◆ clean_cms_seedtracks_iter()

int mkfit::StdSeq::clean_cms_seedtracks_iter ( TrackVec seed_ptr,
const IterationConfig itrcfg,
const BeamSpot bspot 
)

Definition at line 84 of file MkStdSeqs.cc.

References funct::abs(), mkfit::Track::addHitIdx(), mkfit::binnor< C, A1, A2, NB_first, NB_count >::begin_registration(), mkfit::Config::c_dpt_common, mkfit::IterationParams::c_drmax_bh, mkfit::IterationParams::c_drmax_bl, mkfit::IterationParams::c_drmax_eh, mkfit::IterationParams::c_drmax_el, mkfit::IterationParams::c_dzmax_bh, mkfit::IterationParams::c_dzmax_bl, mkfit::IterationParams::c_dzmax_eh, mkfit::IterationParams::c_dzmax_el, mkfit::Config::c_etamax_brl, mkfit::IterationParams::c_ptthr_hpt, mkfit::cdist(), ALCARECOTkAlJpsiMuMu_cff::charge, mkfit::TrackBase::charge(), gather_cfg::cout, d0, mkfit::TrackBase::d0BeamSpot(), PVValHelper::eta, HLT_2022v12_cff::eta1, HLT_2022v12_cff::eta2, f, mkfit::binnor< C, A1, A2, NB_first, NB_count >::finalize_registration(), mkfit::axis_base< R, I, M, N >::from_R_rdr_to_N_bins(), mkfit::axis_pow2_u1< R, I, M, N >::from_R_rdr_to_N_bins(), mkfit::binnor< C, A1, A2, NB_first, NB_count >::get_content(), mkfit::Track::getHitIdx(), mkfit::Track::getHitLyr(), mps_fire::i, testProducerWithPsetDescEmpty_cfi::i1, testProducerWithPsetDescEmpty_cfi::i2, mkfit::TrackBase::invpT(), dqmiolumiharvest::j, mkfit::TrackBase::Status::kMaxSeedHits, mkfit::IterationConfig::m_params, mkfit::binnor< C, A1, A2, NB_first, NB_count >::m_ranks, mkfit::TrackBase::momEta(), mkfit::TrackBase::momPhi(), mkfit::axis_base< R, I, M, N >::next_N_bin(), mkfit::axis_pow2_u1< R, I, M, N >::next_N_bin(), mkfit::Track::nFoundHits(), nHits, mkfit::Track::nTotalHits(), mkfit::Const::PI, funct::pow(), DiDispStaMuonMonitor_cfi::pt, mkfit::TrackBase::pT(), HLT_2022v12_cff::pt1, HLT_2022v12_cff::pt2, mkfit::binnor< C, A1, A2, NB_first, NB_count >::register_entry_safe(), DetachedQuadStep_cff::seeds, mkfit::Track::sortHitsByLayer(), mathSSE::sqrt(), contentValuesCheck::ss, funct::tan(), mkfit::TrackBase::theta(), mkfit::Config::track1GeVradius, tier0::unique(), x, mkfit::TrackBase::x(), mkfit::BeamSpot::x, mkfit::TrackBase::y(), mkfit::BeamSpot::y, and mkfit::TrackBase::z().

Referenced by mkfit::run_OneIteration(), and mkfit::runBtpCe_MultiIter().

84  {
85  const float etamax_brl = Config::c_etamax_brl;
86  const float dpt_common = Config::c_dpt_common;
87 
88  const float dzmax_bh = itrcfg.m_params.c_dzmax_bh;
89  const float drmax_bh = itrcfg.m_params.c_drmax_bh;
90  const float dzmax_eh = itrcfg.m_params.c_dzmax_eh;
91  const float drmax_eh = itrcfg.m_params.c_drmax_eh;
92  const float dzmax_bl = itrcfg.m_params.c_dzmax_bl;
93  const float drmax_bl = itrcfg.m_params.c_drmax_bl;
94  const float dzmax_el = itrcfg.m_params.c_dzmax_el;
95  const float drmax_el = itrcfg.m_params.c_drmax_el;
96 
97  const float ptmin_hpt = itrcfg.m_params.c_ptthr_hpt;
98 
99  const float dzmax2_inv_bh = 1.f / (dzmax_bh * dzmax_bh);
100  const float drmax2_inv_bh = 1.f / (drmax_bh * drmax_bh);
101  const float dzmax2_inv_eh = 1.f / (dzmax_eh * dzmax_eh);
102  const float drmax2_inv_eh = 1.f / (drmax_eh * drmax_eh);
103  const float dzmax2_inv_bl = 1.f / (dzmax_bl * dzmax_bl);
104  const float drmax2_inv_bl = 1.f / (drmax_bl * drmax_bl);
105  const float dzmax2_inv_el = 1.f / (dzmax_el * dzmax_el);
106  const float drmax2_inv_el = 1.f / (drmax_el * drmax_el);
107 
108  // Merge hits from overlapping seeds?
109  // For now always true, we require extra hits after seed.
110  const bool merge_hits = true; // itrcfg.merge_seed_hits_during_cleaning();
111 
112  if (seed_ptr == nullptr)
113  return 0;
114  TrackVec &seeds = *seed_ptr;
115 
116  const int ns = seeds.size();
117 #ifdef DEBUG
118  std::cout << "before seed cleaning " << seeds.size() << std::endl;
119 #endif
120  TrackVec cleanSeedTracks;
121  cleanSeedTracks.reserve(ns);
122  std::vector<bool> writetrack(ns, true);
123 
124  const float invR1GeV = 1.f / Config::track1GeVradius;
125 
126  std::vector<int> nHits(ns);
127  std::vector<int> charge(ns);
128  std::vector<float> oldPhi(ns);
129  std::vector<float> pos2(ns);
130  std::vector<float> eta(ns);
131  std::vector<float> ctheta(ns);
132  std::vector<float> invptq(ns);
133  std::vector<float> pt(ns);
134  std::vector<float> x(ns);
135  std::vector<float> y(ns);
136  std::vector<float> z(ns);
137  std::vector<float> d0(ns);
138  int i1, i2; //for the sorting
139 
140  axis_pow2_u1<float, unsigned short, 16, 8> ax_phi(-Const::PI, Const::PI);
141  axis<float, unsigned short, 8, 8> ax_eta(-3.0, 3.0, 30u);
142  binnor<unsigned int, decltype(ax_phi), decltype(ax_eta), 24, 8> phi_eta_binnor(ax_phi, ax_eta);
143 
144  phi_eta_binnor.begin_registration(ns);
145 
146  for (int ts = 0; ts < ns; ts++) {
147  const Track &tk = seeds[ts];
148  nHits[ts] = tk.nFoundHits();
149  charge[ts] = tk.charge();
150  oldPhi[ts] = tk.momPhi();
151  pos2[ts] = std::pow(tk.x(), 2) + std::pow(tk.y(), 2);
152  eta[ts] = tk.momEta();
153  ctheta[ts] = 1.f / std::tan(tk.theta());
154  invptq[ts] = tk.charge() * tk.invpT();
155  pt[ts] = tk.pT();
156  x[ts] = tk.x();
157  y[ts] = tk.y();
158  z[ts] = tk.z();
159  d0[ts] = tk.d0BeamSpot(bspot.x, bspot.y);
160 
161  phi_eta_binnor.register_entry_safe(oldPhi[ts], eta[ts]);
162  // If one is sure values are *within* axis ranges: b.register_entry(oldPhi[ts], eta[ts]);
163  }
164 
165  phi_eta_binnor.finalize_registration();
166 
167  for (int sorted_ts = 0; sorted_ts < ns; sorted_ts++) {
168  int ts = phi_eta_binnor.m_ranks[sorted_ts];
169 
170  if (not writetrack[ts])
171  continue; // Note: this speed up prevents transitive masking (possibly marginal gain).
172 
173  const float oldPhi1 = oldPhi[ts];
174  const float pos2_first = pos2[ts];
175  const float eta1 = eta[ts];
176  const float pt1 = pt[ts];
177  const float invptq_first = invptq[ts];
178 
179  // To study some more details -- need EventOfHits for this
180  int n_ovlp_hits_added = 0;
181 
182  auto phi_rng = ax_phi.from_R_rdr_to_N_bins(oldPhi[ts], 0.08f);
183  auto eta_rng = ax_eta.from_R_rdr_to_N_bins(eta[ts], .1f);
184 
185  for (auto i_phi = phi_rng.begin; i_phi != phi_rng.end; i_phi = ax_phi.next_N_bin(i_phi)) {
186  for (auto i_eta = eta_rng.begin; i_eta != eta_rng.end; i_eta = ax_eta.next_N_bin(i_eta)) {
187  const auto cbin = phi_eta_binnor.get_content(i_phi, i_eta);
188  for (auto i = cbin.first; i < cbin.end(); ++i) {
189  int tss = phi_eta_binnor.m_ranks[i];
190 
191  if (not writetrack[ts])
192  continue;
193  if (not writetrack[tss])
194  continue;
195  if (tss == ts)
196  continue;
197 
198  const float pt2 = pt[tss];
199 
200  // Always require charge consistency. If different charge is assigned, do not remove seed-track
201  if (charge[tss] != charge[ts])
202  continue;
203 
204  const float thisDPt = std::abs(pt2 - pt1);
205  // Require pT consistency between seeds. If dpT is large, do not remove seed-track.
206  if (thisDPt > dpt_common * pt1)
207  continue;
208 
209  const float eta2 = eta[tss];
210  const float deta2 = std::pow(eta1 - eta2, 2);
211 
212  const float oldPhi2 = oldPhi[tss];
213 
214  const float pos2_second = pos2[tss];
215  const float thisDXYSign05 = pos2_second > pos2_first ? -0.5f : 0.5f;
216 
217  const float thisDXY = thisDXYSign05 * sqrt(std::pow(x[ts] - x[tss], 2) + std::pow(y[ts] - y[tss], 2));
218 
219  const float invptq_second = invptq[tss];
220 
221  const float newPhi1 = oldPhi1 - thisDXY * invR1GeV * invptq_first;
222  const float newPhi2 = oldPhi2 + thisDXY * invR1GeV * invptq_second;
223 
224  const float dphi = cdist(std::abs(newPhi1 - newPhi2));
225 
226  const float dr2 = deta2 + dphi * dphi;
227 
228  const float thisDZ = z[ts] - z[tss] - thisDXY * (ctheta[ts] + ctheta[tss]);
229  const float dz2 = thisDZ * thisDZ;
230 
231  // Reject tracks within dR-dz elliptical window.
232  // Adaptive thresholds, based on observation that duplicates are more abundant at large pseudo-rapidity and low track pT
233  bool overlapping = false;
234  if (std::abs(eta1) < etamax_brl) {
235  if (pt1 > ptmin_hpt) {
236  if (dz2 * dzmax2_inv_bh + dr2 * drmax2_inv_bh < 1.0f)
237  overlapping = true;
238  } else {
239  if (dz2 * dzmax2_inv_bl + dr2 * drmax2_inv_bl < 1.0f)
240  overlapping = true;
241  }
242  } else {
243  if (pt1 > ptmin_hpt) {
244  if (dz2 * dzmax2_inv_eh + dr2 * drmax2_inv_eh < 1.0f)
245  overlapping = true;
246  } else {
247  if (dz2 * dzmax2_inv_el + dr2 * drmax2_inv_el < 1.0f)
248  overlapping = true;
249  }
250  }
251 
252  if (overlapping) {
253  //Mark tss as a duplicate
254  i1 = ts;
255  i2 = tss;
256  if (d0[tss] > d0[ts])
257  writetrack[tss] = false;
258  else {
259  writetrack[ts] = false;
260  i2 = ts;
261  i1 = tss;
262  }
263  // Add hits from tk2 to the seed we are keeping.
264  // NOTE: We have a limit in Track::Status for the number of seed hits.
265  // There is a check at entry and after adding of a new hit.
266  Track &tk = seeds[i1];
267  if (merge_hits && tk.nTotalHits() < Track::Status::kMaxSeedHits) {
268  const Track &tk2 = seeds[i2];
269  //We are not actually fitting to the extra hits; use chi2 of 0
270  float fakeChi2 = 0.0;
271 
272  for (int j = 0; j < tk2.nTotalHits(); ++j) {
273  int hitidx = tk2.getHitIdx(j);
274  int hitlyr = tk2.getHitLyr(j);
275  if (hitidx >= 0) {
276  bool unique = true;
277  for (int i = 0; i < tk.nTotalHits(); ++i) {
278  if ((hitidx == tk.getHitIdx(i)) && (hitlyr == tk.getHitLyr(i))) {
279  unique = false;
280  break;
281  }
282  }
283  if (unique) {
284  tk.addHitIdx(tk2.getHitIdx(j), tk2.getHitLyr(j), fakeChi2);
285  ++n_ovlp_hits_added;
286  if (tk.nTotalHits() >= Track::Status::kMaxSeedHits)
287  break;
288  }
289  }
290  }
291  }
292  if (n_ovlp_hits_added > 0)
293  tk.sortHitsByLayer();
294  }
295  } //end of inner loop over tss
296  } //eta bin
297  } //phi bin
298 
299  if (writetrack[ts]) {
300  cleanSeedTracks.emplace_back(seeds[ts]);
301  }
302  }
303 
304  seeds.swap(cleanSeedTracks);
305 
306 #ifdef DEBUG
307  {
308  const int ns2 = seeds.size();
309  printf("Number of CMS seeds before %d --> after %d cleaning\n", ns, ns2);
310 
311  for (int it = 0; it < ns2; it++) {
312  const Track &ss = seeds[it];
313  printf(" %3i q=%+i pT=%7.3f eta=% 7.3f nHits=%i label=% i\n",
314  it,
315  ss.charge(),
316  ss.pT(),
317  ss.momEta(),
318  ss.nFoundHits(),
319  ss.label());
320  }
321  }
322 #endif
323 
324 #ifdef DEBUG
325  std::cout << "AFTER seed cleaning " << seeds.size() << std::endl;
326 #endif
327 
328  return seeds.size();
329  }
constexpr float c_dpt_common
Definition: Config.h:128
float float float z
constexpr float c_etamax_brl
Definition: Config.h:127
T sqrt(T t)
Definition: SSEVec.h:19
def unique(seq, keepstr=True)
Definition: tier0.py:24
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
#define PI
Definition: QcdUeDQM.h:37
float cdist(float a)
Definition: Config.h:67
std::vector< Track > TrackVec
static constexpr float d0
constexpr float track1GeVradius
Definition: Config.h:126
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t nHits
float x
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ cmssw_LoadHits_Begin()

void mkfit::StdSeq::cmssw_LoadHits_Begin ( EventOfHits eoh,
const std::vector< const HitVec *> &  orig_hitvectors 
)

Definition at line 28 of file MkStdSeqs.cc.

References mps_fire::i, cmsLHEtoEOSManager::l, mkfit::EventOfHits::nLayers(), and mkfit::EventOfHits::reset().

Referenced by MkFitEventOfHitsProducer::produce().

28  {
29  eoh.reset();
30  for (int i = 0; i < eoh.nLayers(); ++i) {
31  auto &&l = eoh[i];
32  l.beginRegistrationOfHits(*orig_hitvectors[l.is_pixel() ? 0 : 1]);
33  }
34  }

◆ cmssw_LoadHits_End()

void mkfit::StdSeq::cmssw_LoadHits_End ( EventOfHits eoh)

Definition at line 44 of file MkStdSeqs.cc.

References mps_fire::i, cmsLHEtoEOSManager::l, and mkfit::EventOfHits::nLayers().

Referenced by MkFitEventOfHitsProducer::produce().

44  {
45  for (int i = 0; i < eoh.nLayers(); ++i) {
46  auto &&l = eoh[i];
47  l.endRegistrationOfHits(false);
48  }
49  }

◆ cmssw_Map_TrackHitIndices()

void mkfit::StdSeq::cmssw_Map_TrackHitIndices ( const EventOfHits eoh,
TrackVec seeds 
)

Definition at line 55 of file MkStdSeqs.cc.

References mps_fire::i, DetachedQuadStep_cff::seeds, and HLT_2022v12_cff::track.

55  {
56  for (auto &&track : seeds) {
57  for (int i = 0; i < track.nTotalHits(); ++i) {
58  const int hitidx = track.getHitIdx(i);
59  const int hitlyr = track.getHitLyr(i);
60  if (hitidx >= 0) {
61  const auto &loh = eoh[hitlyr];
62  track.setHitIdx(i, loh.getHitIndexFromOriginal(hitidx));
63  }
64  }
65  }
66  }

◆ cmssw_ReMap_TrackHitIndices()

void mkfit::StdSeq::cmssw_ReMap_TrackHitIndices ( const EventOfHits eoh,
TrackVec out_tracks 
)

Definition at line 68 of file MkStdSeqs.cc.

References mps_fire::i, and HLT_2022v12_cff::track.

68  {
69  for (auto &&track : out_tracks) {
70  for (int i = 0; i < track.nTotalHits(); ++i) {
71  const int hitidx = track.getHitIdx(i);
72  const int hitlyr = track.getHitLyr(i);
73  if (hitidx >= 0) {
74  const auto &loh = eoh[hitlyr];
75  track.setHitIdx(i, loh.getOriginalHitIndex(hitidx));
76  }
77  }
78  }
79  }

◆ dump_simtracks()

void mkfit::StdSeq::dump_simtracks ( Event event)

Definition at line 52 of file MkStandaloneSeqs.cc.

References dprint, createfilelist::int, and HLT_2022v12_cff::track.

52  {
53  // Ripped out of MkBuilder::begin_event, ifdefed under DEBUG
54 
55  std::vector<Track> &simtracks = event->simTracks_;
56 
57  for (int itrack = 0; itrack < (int)simtracks.size(); ++itrack) {
58  // bool debug = true;
59  Track track = simtracks[itrack];
60  // simtracks are initially written with label = index; uncomment in case tracks were edited
61  // if (track.label() != itrack) {
62  // dprintf("Bad label for simtrack %d -- %d\n", itrack, track.label());
63  // }
64 
65  dprint("MX - simtrack with nHits=" << track.nFoundHits() << " chi2=" << track.chi2() << " pT=" << track.pT()
66  << " phi=" << track.momPhi() << " eta=" << track.momEta());
67  }
68 
69  for (int itrack = 0; itrack < (int)simtracks.size(); ++itrack) {
70  for (int ihit = 0; ihit < simtracks[itrack].nFoundHits(); ++ihit) {
71  dprint("track #" << itrack << " hit #" << ihit
72  << " hit pos=" << simtracks[itrack].hitsVector(event->layerHits_)[ihit].position()
73  << " phi=" << simtracks[itrack].hitsVector(event->layerHits_)[ihit].phi());
74  }
75  }
76  }
#define dprint(x)
Definition: Debug.h:90
Definition: event.py:1

◆ find_and_remove_duplicates()

void mkfit::StdSeq::find_and_remove_duplicates ( TrackVec tracks,
const IterationConfig itconf 
)

Definition at line 591 of file MkStdSeqs.cc.

References gather_cfg::cout, mkfit::IterationParams::drth_central, mkfit::IterationParams::drth_forward, mkfit::IterationParams::drth_obarrel, find_duplicates(), find_duplicates_sharedhits(), find_duplicates_sharedhits_pixelseed(), mkfit::IterationParams::fracSharedHits, mkfit::IterationConfig::m_params, mkfit::IterationConfig::m_requires_dupclean_tight, mkfit::IterationConfig::m_requires_quality_filter, remove_duplicates(), and tracks.

Referenced by mkfit::run_OneIteration(), and mkfit::runBtpCe_MultiIter().

591  {
592 #ifdef DEBUG
593  std::cout << " find_and_remove_duplicates: input track size " << tracks.size() << std::endl;
594 #endif
595  if (itconf.m_requires_quality_filter && !(itconf.m_requires_dupclean_tight)) {
596  find_duplicates_sharedhits(tracks, itconf.m_params.fracSharedHits);
597  } else if (itconf.m_requires_dupclean_tight) {
599  itconf.m_params.fracSharedHits,
600  itconf.m_params.drth_central,
601  itconf.m_params.drth_obarrel,
602  itconf.m_params.drth_forward);
603  } else {
606  }
607 
608 #ifdef DEBUG
609  std::cout << " find_and_remove_duplicates: output track size " << tracks.size() << std::endl;
610  for (auto const &tk : tracks) {
611  std::cout << tk.parameters() << std::endl;
612  }
613 #endif
614  }
void find_duplicates(TrackVec &tracks)
Definition: MkStdSeqs.cc:335
void find_duplicates_sharedhits_pixelseed(TrackVec &tracks, const float fraction, const float drth_central, const float drth_obarrel, const float drth_forward)
Definition: MkStdSeqs.cc:492
void find_duplicates_sharedhits(TrackVec &tracks, const float fraction)
Definition: MkStdSeqs.cc:428
void remove_duplicates(TrackVec &tracks)
Definition: MkStdSeqs.cc:419
auto const & tracks
cannot be loose

◆ find_duplicates()

void mkfit::StdSeq::find_duplicates ( TrackVec tracks)

Definition at line 335 of file MkStdSeqs.cc.

References funct::abs(), HLT_2022v12_cff::eta1, f, mkfit::Config::maxdEta, mkfit::Config::maxdPhi, mkfit::Config::maxdPt, mkfit::Config::maxdR, SiStripPI::min, mkfit::Config::minFracHitsShared, ntracks, PixelLessStep_cff::pixelLessStep, HLT_2022v12_cff::pt1, mkfit::squashPhiMinimal(), TobTecStep_cff::tobTecStep, HLT_2022v12_cff::track, tracks, mitigatedMETSequence_cff::U, and mkfit::Config::useHitsForDuplicates.

Referenced by find_and_remove_duplicates(), handle_duplicates(), and mkfit::runBuildingTestPlexBestHit().

335  {
336  const auto ntracks = tracks.size();
337  float eta1, phi1, pt1, deta, dphi, dr2;
338 
339  if (ntracks == 0) {
340  return;
341  }
342  for (auto itrack = 0U; itrack < ntracks - 1; itrack++) {
343  auto &track = tracks[itrack];
345  auto const algo = track.algorithm();
347  continue;
348  eta1 = track.momEta();
349  phi1 = track.momPhi();
350  pt1 = track.pT();
351  for (auto jtrack = itrack + 1; jtrack < ntracks; jtrack++) {
352  auto &track2 = tracks[jtrack];
353  if (track.label() == track2.label())
354  continue;
355  if (track.algoint() != track2.algoint())
356  continue;
357 
358  deta = std::abs(track2.momEta() - eta1);
359  if (deta > Config::maxdEta)
360  continue;
361 
362  dphi = std::abs(squashPhiMinimal(phi1 - track2.momPhi()));
363  if (dphi > Config::maxdPhi)
364  continue;
365 
366  float maxdR = Config::maxdR;
367  float maxdRSquared = maxdR * maxdR;
368  if (std::abs(eta1) > 2.5f)
369  maxdRSquared *= 16.0f;
370  else if (std::abs(eta1) > 1.44f)
371  maxdRSquared *= 9.0f;
372  dr2 = dphi * dphi + deta * deta;
373  if (dr2 < maxdRSquared) {
374  //Keep track with best score
375  if (track.score() > track2.score())
376  track2.setDuplicateValue(true);
377  else
378  track.setDuplicateValue(true);
379  continue;
380  } else {
381  if (pt1 == 0)
382  continue;
383  if (track2.pT() == 0)
384  continue;
385 
386  if (std::abs((1 / track2.pT()) - (1 / pt1)) < Config::maxdPt) {
388  float numHitsShared = 0;
389  for (int ihit2 = 0; ihit2 < track2.nTotalHits(); ihit2++) {
390  const int hitidx2 = track2.getHitIdx(ihit2);
391  const int hitlyr2 = track2.getHitLyr(ihit2);
392  if (hitidx2 >= 0) {
393  auto const it = std::find_if(track.beginHitsOnTrack(),
394  track.endHitsOnTrack(),
395  [&hitidx2, &hitlyr2](const HitOnTrack &element) {
396  return (element.index == hitidx2 && element.layer == hitlyr2);
397  });
398  if (it != track.endHitsOnTrack())
399  numHitsShared++;
400  }
401  }
402 
403  float fracHitsShared = numHitsShared / std::min(track.nFoundHits(), track2.nFoundHits());
404  //Only remove one of the tracks if they share at least X% of the hits (denominator is the shorter track)
405  if (fracHitsShared < Config::minFracHitsShared)
406  continue;
407  }
408  //Keep track with best score
409  if (track.score() > track2.score())
410  track2.setDuplicateValue(true);
411  else
412  track.setDuplicateValue(true);
413  } //end of if dPt
414  } //end of else
415  } //end of loop over track2
416  } //end of loop over track1
417  }
float squashPhiMinimal(float phi)
Definition: Hit.h:26
const float maxdPt
Definition: Config.cc:31
const float maxdR
Definition: Config.cc:34
const float maxdEta
Definition: Config.cc:33
const float maxdPhi
Definition: Config.cc:32
TrackBase::TrackAlgorithm TrackAlgorithm
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
auto const & tracks
cannot be loose
const bool useHitsForDuplicates
Definition: Config.h:142
Definition: fakeMenu.h:6
const float minFracHitsShared
Definition: Config.cc:35

◆ find_duplicates_sharedhits()

void mkfit::StdSeq::find_duplicates_sharedhits ( TrackVec tracks,
const float  fraction 
)

Definition at line 428 of file MkStdSeqs.cc.

References a, funct::abs(), b, HLT_2022v12_cff::fraction, mps_fire::i, SiStripPI::min, ntracks, FastTimerService_cff::range, mkfit::squashPhiMinimal(), funct::tan(), HLT_2022v12_cff::track, tracks, and mitigatedMETSequence_cff::U.

Referenced by find_and_remove_duplicates().

428  {
429  const auto ntracks = tracks.size();
430 
431  std::vector<float> ctheta(ntracks);
432  std::multimap<int, int> hitMap;
433 
434  for (auto itrack = 0U; itrack < ntracks; itrack++) {
435  auto &trk = tracks[itrack];
436  ctheta[itrack] = 1.f / std::tan(trk.theta());
437  for (int i = 0; i < trk.nTotalHits(); ++i) {
438  if (trk.getHitIdx(i) < 0)
439  continue;
440  int a = trk.getHitLyr(i);
441  int b = trk.getHitIdx(i);
442  hitMap.insert(std::make_pair(b * 1000 + a, i > 0 ? itrack : -itrack)); //negative for first hit in trk
443  }
444  }
445 
446  for (auto itrack = 0U; itrack < ntracks; itrack++) {
447  auto &trk = tracks[itrack];
448  auto phi1 = trk.momPhi();
449  auto ctheta1 = ctheta[itrack];
450 
451  std::map<int, int> sharingMap;
452  for (int i = 0; i < trk.nTotalHits(); ++i) {
453  if (trk.getHitIdx(i) < 0)
454  continue;
455  int a = trk.getHitLyr(i);
456  int b = trk.getHitIdx(i);
457  auto range = hitMap.equal_range(b * 1000 + a);
458  for (auto it = range.first; it != range.second; ++it) {
459  if (std::abs(it->second) >= (int)itrack)
460  continue; // don't check your own hits (==) nor sym. checks (>)
461  if (i == 0 && it->second < 0)
462  continue; // shared first - first is not counted
463  sharingMap[std::abs(it->second)]++;
464  }
465  }
466 
467  for (const auto &elem : sharingMap) {
468  auto &track2 = tracks[elem.first];
469 
470  // broad dctheta-dphi compatibility checks; keep mostly to preserve consistency with old results
471  auto dctheta = std::abs(ctheta[elem.first] - ctheta1);
472  if (dctheta > 1.)
473  continue;
474 
475  auto dphi = std::abs(squashPhiMinimal(phi1 - track2.momPhi()));
476  if (dphi > 1.)
477  continue;
478 
479  if (elem.second >= std::min(trk.nFoundHits(), track2.nFoundHits()) * fraction) {
480  if (trk.score() > track2.score())
481  track2.setDuplicateValue(true);
482  else
483  trk.setDuplicateValue(true);
484  }
485  } // end sharing hits loop
486  } // end trk loop
487 
488  tracks.erase(std::remove_if(tracks.begin(), tracks.end(), [](auto track) { return track.getDuplicateValue(); }),
489  tracks.end());
490  }
float squashPhiMinimal(float phi)
Definition: Hit.h:26
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
auto const & tracks
cannot be loose
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119

◆ find_duplicates_sharedhits_pixelseed()

void mkfit::StdSeq::find_duplicates_sharedhits_pixelseed ( TrackVec tracks,
const float  fraction,
const float  drth_central,
const float  drth_obarrel,
const float  drth_forward 
)

Definition at line 492 of file MkStdSeqs.cc.

References a, funct::abs(), b, c, ztail::d, HLT_2022v12_cff::fraction, mps_fire::i, dqmiolumiharvest::j, mkfit::Config::maxcth_fw, mkfit::Config::maxcth_ob, mkfit::Config::maxd1pt, mkfit::Config::maxdcth, mkfit::Config::maxdphi, SiStripPI::min, ntracks, mkfit::squashPhiMinimal(), funct::tan(), HLT_2022v12_cff::track, tracks, and mitigatedMETSequence_cff::U.

Referenced by find_and_remove_duplicates().

496  {
497  const auto ntracks = tracks.size();
498 
499  std::vector<float> ctheta(ntracks);
500  for (auto itrack = 0U; itrack < ntracks; itrack++) {
501  auto &trk = tracks[itrack];
502  ctheta[itrack] = 1.f / std::tan(trk.theta());
503  }
504 
505  float phi1, invpt1, dctheta, ctheta1, dphi, dr2;
506  for (auto itrack = 0U; itrack < ntracks; itrack++) {
507  auto &trk = tracks[itrack];
508  phi1 = trk.momPhi();
509  invpt1 = trk.invpT();
510  ctheta1 = ctheta[itrack];
511  for (auto jtrack = itrack + 1; jtrack < ntracks; jtrack++) {
512  auto &track2 = tracks[jtrack];
513  if (trk.label() == track2.label())
514  continue;
515 
516  dctheta = std::abs(ctheta[jtrack] - ctheta1);
517 
518  if (dctheta > Config::maxdcth)
519  continue;
520 
521  dphi = std::abs(squashPhiMinimal(phi1 - track2.momPhi()));
522 
523  if (dphi > Config::maxdphi)
524  continue;
525 
526  float maxdRSquared = drth_central * drth_central;
527  if (std::abs(ctheta1) > Config::maxcth_fw)
528  maxdRSquared = drth_forward * drth_forward;
529  else if (std::abs(ctheta1) > Config::maxcth_ob)
530  maxdRSquared = drth_obarrel * drth_obarrel;
531  dr2 = dphi * dphi + dctheta * dctheta;
532  if (dr2 < maxdRSquared) {
533  //Keep track with best score
534  if (trk.score() > track2.score())
535  track2.setDuplicateValue(true);
536  else
537  trk.setDuplicateValue(true);
538  continue;
539  }
540 
541  if (std::abs(track2.invpT() - invpt1) > Config::maxd1pt)
542  continue;
543 
544  auto sharedCount = 0;
545  auto sharedFirst = 0;
546  const auto minFoundHits = std::min(trk.nFoundHits(), track2.nFoundHits());
547 
548  for (int i = 0; i < trk.nTotalHits(); ++i) {
549  if (trk.getHitIdx(i) < 0)
550  continue;
551  const int a = trk.getHitLyr(i);
552  const int b = trk.getHitIdx(i);
553  for (int j = 0; j < track2.nTotalHits(); ++j) {
554  if (track2.getHitIdx(j) < 0)
555  continue;
556  const int c = track2.getHitLyr(j);
557  const int d = track2.getHitIdx(j);
558 
559  //this is to count once shared matched hits (may be done more properly...)
560  if (a == c && b == d)
561  sharedCount += 1;
562  if (j == 0 && i == 0 && a == c && b == d)
563  sharedFirst += 1;
564 
565  if ((sharedCount - sharedFirst) >= ((minFoundHits - sharedFirst) * fraction))
566  continue;
567  }
568  if ((sharedCount - sharedFirst) >= ((minFoundHits - sharedFirst) * fraction))
569  continue;
570  }
571 
572  //selection here - 11percent fraction of shared hits to label a duplicate
573  if ((sharedCount - sharedFirst) >= ((minFoundHits - sharedFirst) * fraction)) {
574  if (trk.score() > track2.score())
575  track2.setDuplicateValue(true);
576  else
577  trk.setDuplicateValue(true);
578  }
579  }
580  } //end loop one over tracks
581 
582  //removal here
583  tracks.erase(std::remove_if(tracks.begin(), tracks.end(), [](auto track) { return track.getDuplicateValue(); }),
584  tracks.end());
585  }
float squashPhiMinimal(float phi)
Definition: Hit.h:26
const float maxdphi
Definition: Config.cc:38
const float maxd1pt
Definition: Config.cc:37
const float maxdcth
Definition: Config.cc:39
const float maxcth_fw
Definition: Config.cc:41
const float maxcth_ob
Definition: Config.cc:40
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
d
Definition: ztail.py:151
auto const & tracks
cannot be loose
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119

◆ handle_duplicates()

void mkfit::StdSeq::handle_duplicates ( Event event)

Definition at line 32 of file MkStandaloneSeqs.cc.

References mkfit::Config::backwardFit, mkfit::Config::cmssw_val, find_duplicates(), mkfit::Config::quality_val, and mkfit::Config::sim_val.

Referenced by mkfit::runBuildingTestPlexCloneEngine(), and mkfit::runBuildingTestPlexStandard().

32  {
33  // Mark tracks as duplicates; if within CMSSW, remove duplicate tracks from fit or candidate track collection
34  if (Config::removeDuplicates) {
36  find_duplicates(event->candidateTracks_);
38  find_duplicates(event->fitTracks_);
39  }
40  // For the MEIF benchmarks and the stress tests, no validation flags are set so we will enter this block
41  else {
42  // Only care about the candidate tracks here; no need to run the duplicate removal on both candidate and fit tracks
43  find_duplicates(event->candidateTracks_);
44  }
45  }
46  }
void find_duplicates(TrackVec &tracks)
Definition: MkStdSeqs.cc:335
Definition: event.py:1

◆ loadDeads()

void mkfit::StdSeq::loadDeads ( EventOfHits eoh,
const std::vector< DeadVec > &  deadvectors 
)

Definition at line 18 of file MkStdSeqs.cc.

References mkfit::EventOfHits::suckInDeads().

Referenced by MkFitEventOfHitsProducer::produce(), and test_standard().

18  {
19  for (size_t il = 0; il < deadvectors.size(); il++) {
20  eoh.suckInDeads(int(il), deadvectors[il]);
21  }
22  }

◆ loadHitsAndBeamSpot()

void mkfit::StdSeq::loadHitsAndBeamSpot ( Event ev,
EventOfHits eoh 
)

Definition at line 19 of file MkStandaloneSeqs.cc.

References makeMEIFBenchmarkPlots::ev, hgcalTopologyTester_cfi::layers, mkfit::EventOfHits::reset(), mkfit::EventOfHits::setBeamSpot(), and mkfit::EventOfHits::suckInHits().

Referenced by test_standard().

19  {
20  eoh.reset();
21 
22  // fill vector of hits in each layer
23  // XXXXMT: Does it really makes sense to multi-thread this?
24  tbb::parallel_for(tbb::blocked_range<int>(0, ev.layerHits_.size()), [&](const tbb::blocked_range<int> &layers) {
25  for (int ilay = layers.begin(); ilay < layers.end(); ++ilay) {
26  eoh.suckInHits(ilay, ev.layerHits_[ilay]);
27  }
28  });
29  eoh.setBeamSpot(ev.beamSpot_);
30  }

◆ prep_cmsswtracks()

void mkfit::StdSeq::prep_cmsswtracks ( Event event)

Definition at line 375 of file MkStandaloneSeqs.cc.

References prep_reftracks().

Referenced by root_val().

375 { prep_reftracks(event, event->cmsswTracks_, event->cmsswTracksExtra_, true); }
void prep_reftracks(Event *event, TrackVec &tracks, TrackExtraVec &extras, const bool realigntracks)
Definition: event.py:1

◆ prep_recotracks()

void mkfit::StdSeq::prep_recotracks ( Event event)

Definition at line 282 of file MkStandaloneSeqs.cc.

References mkfit::Config::cmssw_val, prep_tracks(), mkfit::Config::sim_val, and mkfit::Config::sim_val_for_cmssw.

Referenced by root_val(), and root_val_dumb_cmssw().

282  {
283  // seed tracks extras always needed
285  prep_tracks(event, event->seedTracks_, event->seedTracksExtra_, true);
286  } else if (Config::cmssw_val) // seed tracks are not validated, labels used for maps --> do NOT align index and labels!
287  {
288  prep_tracks(event, event->seedTracks_, event->seedTracksExtra_, false);
289  }
290 
291  // make extras + align index == label() for candidate tracks
292  prep_tracks(event, event->candidateTracks_, event->candidateTracksExtra_, true);
293  prep_tracks(event, event->fitTracks_, event->fitTracksExtra_, true);
294  }
void prep_tracks(Event *event, TrackVec &tracks, TrackExtraVec &extras, const bool realigntracks)
Definition: event.py:1

◆ prep_reftracks()

void mkfit::StdSeq::prep_reftracks ( Event event,
TrackVec tracks,
TrackExtraVec extras,
const bool  realigntracks 
)

Definition at line 377 of file MkStandaloneSeqs.cc.

References mkfit::Config::cmsSelMinLayers, prep_tracks(), HLT_2022v12_cff::track, and tracks.

Referenced by prep_cmsswtracks(), and prep_simtracks().

377  {
378  prep_tracks(event, tracks, extras, realigntracks);
379 
380  // mark cmsswtracks as unfindable if too short
381  for (auto &track : tracks) {
382  const int nlyr = track.nUniqueLayers();
383  if (nlyr < Config::cmsSelMinLayers)
384  track.setNotFindable();
385  }
386  }
void prep_tracks(Event *event, TrackVec &tracks, TrackExtraVec &extras, const bool realigntracks)
auto const & tracks
cannot be loose
Definition: event.py:1

◆ prep_simtracks()

void mkfit::StdSeq::prep_simtracks ( Event event)

Definition at line 296 of file MkStandaloneSeqs.cc.

References funct::abs(), submitPVResolutionJobs::count, spr::find(), heavyIonCSV_trainingSettings::idx, label, mkfit::Config::mtvLikeValidation, mkfit::Config::mtvRequireSeeds, prep_reftracks(), and mkfit::TrackBase::Signal.

Referenced by root_val_dumb_cmssw(), and mkfit::runBtpCe_MultiIter().

296  {
297  // First prep sim tracks to have hits sorted, then mark unfindable if too short
298  prep_reftracks(event, event->simTracks_, event->simTracksExtra_, false);
299 
300  // Now, make sure sim track shares at least four hits with a single cmssw seed.
301  // This ensures we factor out any weakness from CMSSW
302 
303  // First, make a make a map of [lyr][hit idx].vector(seed trk labels)
304  LayIdxIDVecMapMap seedHitIDMap;
305  std::map<int, int> labelNHitsMap;
306  std::map<int, int> labelAlgoMap;
307  std::map<int, std::vector<int>> labelSeedHitsMap;
308  for (const auto &seedtrack : event->seedTracks_) {
309  for (int ihit = 0; ihit < seedtrack.nTotalHits(); ihit++) {
310  const auto lyr = seedtrack.getHitLyr(ihit);
311  const auto idx = seedtrack.getHitIdx(ihit);
312 
313  if (lyr < 0 || idx < 0)
314  continue; // standard check
315  seedHitIDMap[lyr][idx].push_back(seedtrack.label());
316  labelSeedHitsMap[seedtrack.label()].push_back(lyr);
317  }
318  labelNHitsMap[seedtrack.label()] = seedtrack.nTotalHits();
319  labelAlgoMap[seedtrack.label()] = seedtrack.algoint();
320  }
321 
322  // Then, loop over sim tracks, and add up how many lyrs they possess of a single seed track
323  unsigned int count = 0;
324  for (auto &simtrack : event->simTracks_) {
325  if (simtrack.isNotFindable())
326  continue; // skip ones we already know are bad
327  TrkIDLaySetMap seedIDMap;
328  for (int ihit = 0; ihit < simtrack.nTotalHits(); ihit++) {
329  const auto lyr = simtrack.getHitLyr(ihit);
330  const auto idx = simtrack.getHitIdx(ihit);
331 
332  if (lyr < 0 || idx < 0)
333  continue; // standard check
334 
335  if (!seedHitIDMap.count(lyr))
336  continue; // ensure seed hit map has at least one entry for this layer
337  if (!seedHitIDMap.at(lyr).count(idx))
338  continue; // ensure seed hit map has at least one entry for this idx
339 
340  for (const auto label : seedHitIDMap.at(lyr).at(idx)) {
341  const auto &seedLayers = labelSeedHitsMap[label];
342  if (std::find(seedLayers.begin(), seedLayers.end(), lyr) != seedLayers.end()) //seed check moved here
343  seedIDMap[label].emplace(lyr);
344  }
345  }
346 
347  // now see if one of the seedIDs matched has at least 4 hits!
348  bool isSimSeed = false;
349  for (const auto &seedIDpair : seedIDMap) {
350  if ((int)seedIDpair.second.size() == labelNHitsMap[seedIDpair.first]) {
351  isSimSeed = true;
353  simtrack.setAlgoint(labelAlgoMap[seedIDpair.first]);
355  event->simTracksExtra_[count].addAlgo(labelAlgoMap[seedIDpair.first]);
356  //break;
357  }
358  }
360  // Apply MTV selection criteria and then return
361  if (simtrack.prodType() != Track::ProdType::Signal || simtrack.charge() == 0 || simtrack.posR() > 2.5 ||
362  std::abs(simtrack.z()) > 30 || std::abs(simtrack.momEta()) > 3.0)
363  simtrack.setNotFindable();
364  else if (Config::mtvRequireSeeds && !isSimSeed)
365  simtrack.setNotFindable();
366  } else {
367  // set findability based on bool isSimSeed
368  if (!isSimSeed)
369  simtrack.setNotFindable();
370  }
371  count++;
372  }
373  }
void prep_reftracks(Event *event, TrackVec &tracks, TrackExtraVec &extras, const bool realigntracks)
std::map< int, std::unordered_set< int > > TrkIDLaySetMap
Definition: TrackExtra.h:38
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
char const * label
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::map< int, std::map< int, std::vector< int > > > LayIdxIDVecMapMap
Definition: TrackExtra.h:37
Definition: event.py:1

◆ prep_tracks()

void mkfit::StdSeq::prep_tracks ( Event event,
TrackVec tracks,
TrackExtraVec extras,
const bool  realigntracks 
)

Definition at line 388 of file MkStandaloneSeqs.cc.

References mps_fire::i, label, and tracks.

Referenced by prep_recotracks(), and prep_reftracks().

388  {
389  for (size_t i = 0; i < tracks.size(); i++) {
390  extras.emplace_back(tracks[i].label());
391  }
392  if (realigntracks)
393  event->validation_.alignTracks(tracks, extras, false);
394  }
char const * label
auto const & tracks
cannot be loose

◆ qfilter_n_hits()

template<class TRACK >
bool mkfit::StdSeq::qfilter_n_hits ( const TRACK &  t,
int  nMinHits 
)

Definition at line 42 of file MkStdSeqs.h.

References submitPVValidationJobs::t.

Referenced by mkfit::run_OneIteration(), and mkfit::runBtpCe_MultiIter().

42  {
43  int seedHits = t.getNSeedHits();
44  int seedReduction = (seedHits <= 5) ? 2 : 3;
45  return t.nFoundHits() - seedReduction >= nMinHits;
46  }

◆ qfilter_n_hits_pixseed()

template<class TRACK >
bool mkfit::StdSeq::qfilter_n_hits_pixseed ( const TRACK &  t,
int  nMinHits 
)

Definition at line 50 of file MkStdSeqs.h.

References submitPVValidationJobs::t.

Referenced by mkfit::run_OneIteration(), and mkfit::runBtpCe_MultiIter().

50  {
51  return t.nFoundHits() >= nMinHits;
52  }

◆ qfilter_n_layers()

template<class TRACK >
bool mkfit::StdSeq::qfilter_n_layers ( const TRACK &  t,
const BeamSpot bspot,
const TrackerInfo trk_inf 
)

Definition at line 56 of file MkStdSeqs.h.

References funct::abs(), MuonTCMETValueMapProducer_cff::d0_max, submitPVValidationJobs::t, mkfit::BeamSpot::x, and mkfit::BeamSpot::y.

Referenced by mkfit::run_OneIteration(), and mkfit::runBtpCe_MultiIter().

56  {
57  int enhits = t.nHitsByTypeEncoded(trk_inf);
58  int npixhits = t.nPixelDecoded(enhits);
59  int enlyrs = t.nLayersByTypeEncoded(trk_inf);
60  int npixlyrs = t.nPixelDecoded(enlyrs);
61  int nmatlyrs = t.nTotMatchDecoded(enlyrs);
62  int llyr = t.getLastFoundHitLyr();
63  int lplyr = t.getLastFoundPixelHitLyr();
64  float invpt = t.invpT();
65  float invptmin = 1.43; // min 1/pT (=1/0.7) for full filter on (npixhits<=3 .or. npixlyrs<=3)
66  float d0BS = t.d0BeamSpot(bspot.x, bspot.y);
67  float d0_max = 0.1; // 1 mm
68 
69  bool endsInsidePix = (llyr == 2 || llyr == 18 || llyr == 45);
70  bool lastInsidePix = ((0 <= lplyr && lplyr < 3) || (18 <= lplyr && lplyr < 20) || (45 <= lplyr && lplyr < 47));
71  return !(((npixhits <= 3 || npixlyrs <= 3) && endsInsidePix &&
72  (invpt < invptmin || (invpt >= invptmin && std::abs(d0BS) > d0_max))) ||
73  ((npixlyrs <= 3 && nmatlyrs <= 6) && lastInsidePix && llyr != lplyr && std::abs(d0BS) > d0_max));
74  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ qfilter_nan_n_silly()

template<class TRACK >
bool mkfit::StdSeq::qfilter_nan_n_silly ( const TRACK &  t)

Definition at line 128 of file MkStdSeqs.h.

References submitPVValidationJobs::t.

Referenced by mkfit::run_OneIteration(), and mkfit::runBtpCe_MultiIter().

128  {
129  return !(t.hasNanNSillyValues());
130  }

◆ qfilter_pixelLessBkwd()

template<class TRACK >
bool mkfit::StdSeq::qfilter_pixelLessBkwd ( const TRACK &  t,
const BeamSpot bspot,
const TrackerInfo tk_info 
)

quality filter tuned for pixelLess iteration during backward search

Definition at line 104 of file MkStdSeqs.h.

References funct::abs(), MuonTCMETValueMapProducer_cff::d0_max, nHits, mkfit::Const::PIOver2, submitPVValidationJobs::t, mkfit::BeamSpot::x, and mkfit::BeamSpot::y.

Referenced by mkfit::run_OneIteration(), and mkfit::runBtpCe_MultiIter().

104  {
105  float d0BS = t.d0BeamSpot(bspot.x, bspot.y);
106  float d0_max = 0.1; // 1 mm
107 
108  int encoded;
109  encoded = t.nLayersByTypeEncoded(tk_info);
110  int nLyrs = t.nTotMatchDecoded(encoded);
111  encoded = t.nHitsByTypeEncoded(tk_info);
112  int nHits = t.nTotMatchDecoded(encoded);
113 
114  float invpt = t.invpT();
115  float invptmin = 1.11; // =1/0.9
116 
117  float thetasym = std::abs(t.theta() - Const::PIOver2);
118  float thetasymmin_l = 0.80; // -> |eta|=0.9
119  float thetasymmin_h = 1.11; // -> |eta|=1.45
120 
121  return !(
122  ((nLyrs <= 3 || nHits <= 3)) ||
123  ((nLyrs <= 4 || nHits <= 4) && (invpt < invptmin || (thetasym > thetasymmin_l && std::abs(d0BS) > d0_max))) ||
124  ((nLyrs <= 6 || nHits <= 6) && (invpt > invptmin && thetasym > thetasymmin_h && std::abs(d0BS) > d0_max)));
125  }
constexpr float PIOver2
Definition: Config.h:44
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t nHits

◆ qfilter_pixelLessFwd()

template<class TRACK >
bool mkfit::StdSeq::qfilter_pixelLessFwd ( const TRACK &  t,
const BeamSpot bspot,
const TrackerInfo tk_info 
)

quality filter tuned for pixelLess iteration during forward search

Definition at line 78 of file MkStdSeqs.h.

References funct::abs(), MuonTCMETValueMapProducer_cff::d0_max, nHits, mkfit::Const::PIOver2, submitPVValidationJobs::t, mkfit::BeamSpot::x, and mkfit::BeamSpot::y.

Referenced by mkfit::run_OneIteration(), and mkfit::runBtpCe_MultiIter().

78  {
79  float d0BS = t.d0BeamSpot(bspot.x, bspot.y);
80  float d0_max = 0.05; // 0.5 mm
81 
82  int encoded;
83  encoded = t.nLayersByTypeEncoded(tk_info);
84  int nLyrs = t.nTotMatchDecoded(encoded);
85  encoded = t.nHitsByTypeEncoded(tk_info);
86  int nHits = t.nTotMatchDecoded(encoded);
87 
88  int seedReduction = (t.getNSeedHits() <= 5) ? 2 : 3;
89 
90  float invpt = t.invpT();
91  float invptmin = 1.11; // =1/0.9
92 
93  float thetasym = std::abs(t.theta() - Const::PIOver2);
94  float thetasymmin = 1.11; // -> |eta|=1.45
95 
96  return (((t.nFoundHits() - seedReduction >= 4 && invpt < invptmin) ||
97  (t.nFoundHits() - seedReduction >= 3 && invpt > invptmin && thetasym <= thetasymmin) ||
98  (t.nFoundHits() - seedReduction >= 4 && invpt > invptmin && thetasym > thetasymmin)) &&
99  !((nLyrs <= 4 || nHits <= 4) && std::abs(d0BS) > d0_max && invpt < invptmin));
100  }
constexpr float PIOver2
Definition: Config.h:44
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t nHits

◆ remove_duplicates()

void mkfit::StdSeq::remove_duplicates ( TrackVec tracks)

Definition at line 419 of file MkStdSeqs.cc.

References HLT_2022v12_cff::track, and tracks.

Referenced by find_and_remove_duplicates().

419  {
420  tracks.erase(std::remove_if(tracks.begin(), tracks.end(), [](auto track) { return track.getDuplicateValue(); }),
421  tracks.end());
422  }
auto const & tracks
cannot be loose

◆ root_val()

void mkfit::StdSeq::root_val ( Event event)

Definition at line 262 of file MkStandaloneSeqs.cc.

References mkfit::Config::backwardFit, mkfit::Config::cmssw_val, prep_cmsswtracks(), prep_recotracks(), and score_tracks().

Referenced by mkfit::runBtpCe_MultiIter(), mkfit::runBuildingTestPlexBestHit(), mkfit::runBuildingTestPlexCloneEngine(), and mkfit::runBuildingTestPlexStandard().

262  {
263  // score the tracks
264  score_tracks(event->seedTracks_);
265  score_tracks(event->candidateTracks_);
266 
267  // deal with fit tracks
268  if (Config::backwardFit) {
269  score_tracks(event->fitTracks_);
270  } else
271  event->fitTracks_ = event->candidateTracks_;
272 
273  // sort hits + make extras, align if needed
275  if (Config::cmssw_val)
277 
278  // validate
279  event->validate();
280  }
void score_tracks(TrackVec &tracks)
void prep_recotracks(Event *event)
Definition: event.py:1
void prep_cmsswtracks(Event *event)

◆ root_val_dumb_cmssw()

void mkfit::StdSeq::root_val_dumb_cmssw ( Event event)

Definition at line 241 of file MkStandaloneSeqs.cc.

References mkfit::Config::nItersCMSSW, prep_recotracks(), and prep_simtracks().

Referenced by mkfit::runBuildingTestPlexDumbCMSSW().

241  {
242  // get labels correct first
243  event->relabel_bad_seedtracks();
244  event->relabel_cmsswtracks_from_seeds();
245 
246  //collection cleaning
247  if (Config::nItersCMSSW > 0)
248  event->select_tracks_iter(Config::nItersCMSSW);
249 
250  // set the track collections to each other
251  event->candidateTracks_ = event->cmsswTracks_;
252  event->fitTracks_ = event->candidateTracks_;
253 
254  // prep the tracks + extras
257 
258  // validate
259  event->validate();
260  }
void prep_simtracks(Event *event)
void prep_recotracks(Event *event)
Definition: event.py:1

◆ score_tracks()

void mkfit::StdSeq::score_tracks ( TrackVec tracks)

Definition at line 396 of file MkStandaloneSeqs.cc.

References mkfit::getScoreCand(), HLT_2022v12_cff::track, and tracks.

Referenced by root_val().

396  {
397  for (auto &track : tracks) {
398  track.setScore(getScoreCand(track));
399  }
400  }
float getScoreCand(const Track &cand1, bool penalizeTailMissHits=false, bool inFindCandidates=false)
Definition: Track.h:630
auto const & tracks
cannot be loose

◆ track_print()

void mkfit::StdSeq::track_print ( Event event,
const Track t,
const char *  pref 
)

Definition at line 78 of file MkStandaloneSeqs.cc.

References heavyIonCSV_trainingSettings::idx, mkfit::print(), submitPVValidationJobs::t, and hit::z.

Referenced by mkfit::StdSeq::Quality::quality_process().

78  {
79  printf("%s with q=%+i pT=%7.3f eta=% 7.3f nHits=%2d label=%4d\nState:\n",
80  pref,
81  t.charge(),
82  t.pT(),
83  t.momEta(),
84  t.nFoundHits(),
85  t.label());
86 
87  print(t.state());
88 
89  printf("Hits:\n");
90  for (int ih = 0; ih < t.nTotalHits(); ++ih) {
91  int lyr = t.getHitLyr(ih);
92  int idx = t.getHitIdx(ih);
93  if (idx >= 0) {
94  const Hit &hit = event->layerHits_[lyr][idx];
95  printf(" hit %2d lyr=%2d idx=%4d pos r=%7.3f z=% 8.3f mc_hit=%4d mc_trk=%4d\n",
96  ih,
97  lyr,
98  idx,
99  hit.r(),
100  hit.z(),
101  hit.mcHitID(),
102  hit.mcTrackID(event->simHitsInfo_));
103  } else
104  printf(" hit %2d idx=%i\n", ih, t.getHitIdx(ih));
105  }
106  }
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
Definition: event.py:1