CMS 3D CMS Logo

Shell.cc
Go to the documentation of this file.
2 
4 
5 // #include "RecoTracker/MkFitCore/src/Matriplex/MatriplexCommon.h"
6 
8 
14 
17 
19 
21 
22 #include "TROOT.h"
23 #include "TRint.h"
24 
25 #ifdef WITH_REVE
26 #include "TRandom.h"
27 #include "ROOT/REveJetCone.hxx"
28 #include "ROOT/REveManager.hxx"
29 #include "ROOT/REveScene.hxx"
30 #include "ROOT/REveBoxSet.hxx"
31 #endif
32 
33 #include "oneapi/tbb/task_arena.h"
34 
35 #include <vector>
36 
37 // clang-format off
38 
39 namespace {
40  constexpr int algos[] = {4, 22, 23, 5, 24, 7, 8, 9, 10, 6}; // 10 iterations
41  constexpr int n_algos = sizeof(algos) / sizeof(int);
42 
43  const char* b2a(bool b) { return b ? "true" : "false"; }
44 }
45 
46 namespace mkfit {
47 
48  Shell::Shell(std::vector<DeadVec> &dv, const std::string &in_file, int start_ev)
49  : m_deadvectors(dv)
50  {
53 
55 
56  m_data_file = new DataFile;
57  m_event = new Event(0, Config::TrkInfo.n_layers());
58 
59  if ( ! in_file.empty() && Config::nEvents > 0) {
61  GoToEvent(start_ev);
62  } else {
63  printf("Shell initialized but the %s, running on an empty Event.\n",
64  in_file.empty() ? "input-file not specified" : "requested number of events to process is 0");
65  }
66  }
67 
69  delete m_event;
70  delete m_data_file;
71  delete m_builder;
72  delete m_eoh;
73  delete gApplication;
74  }
75 
76  void Shell::Run() {
77  std::vector<const char *> argv = { "mkFit", "-l" };
78  int argc = argv.size();
79  gApplication = new TRint("mkFit-shell", &argc, const_cast<char**>(argv.data()));
80 
81  char buf[256];
82  sprintf(buf, "mkfit::Shell &s = * (mkfit::Shell*) %p;", this);
83  gROOT->ProcessLine(buf);
84  printf("Shell &s variable is set: ");
85  gROOT->ProcessLine("s");
86 
87  gApplication->Run(true);
88  printf("Shell::Run finished\n");
89  }
90 
91  void Shell::Status() {
92  printf("On event %d, selected iteration index %d, algo %d - %s\n"
93  " debug = %s, use_dead_modules = %s\n"
94  " clean_seeds = %s, backward_fit = %s, remove_duplicates = %s\n",
98  }
99 
101 
102  //===========================================================================
103  // Event navigation / processing
104  //===========================================================================
105 
106  void Shell::GoToEvent(int eid) {
107  if (eid < 1) {
108  fprintf(stderr, "Requested event %d is less than 1 -- 1 is the first event, %d is total number of events in file\n",
109  eid, m_evs_in_file);
110  throw std::runtime_error("event out of range");
111  }
112  if (eid > m_evs_in_file) {
113  fprintf(stderr, "Requested event %d is grater than total number of events in file %d\n",
114  eid, m_evs_in_file);
115  throw std::runtime_error("event out of range");
116  }
117 
118  int pos = m_event->evtID();
119  if (eid > pos) {
120  m_data_file->skipNEvents(eid - pos - 1);
121  } else {
122  m_data_file->rewind();
124  }
125  m_event->resetCurrentSeedTracks(); // left after ProcessEvent() for debugging etc
126  m_event->reset(eid);
131  }
132 
133  printf("At event %d\n", eid);
134  }
135 
136  void Shell::NextEvent(int skip) {
137  GoToEvent(m_event->evtID() + skip);
138  }
139 
140  void Shell::ProcessEvent(SeedSelect_e seed_select, int selected_seed, int count) {
141  // count is only used for SS_IndexPreCleaning and SS_IndexPostCleaning.
142  // There are no checks for upper bounds, ie, if requested seeds beyond the first one exist.
143 
144  const IterationConfig &itconf = Config::ItrInfo[m_it_index];
145  IterationMaskIfc mask_ifc;
147 
148  m_seeds.clear();
149  m_tracks.clear();
150 
151  {
152  int n_algo = 0; // seeds are grouped by algo
153  for (auto &s : m_event->seedTracks_) {
154  if (s.algoint() == itconf.m_track_algorithm) {
155  if (seed_select == SS_UseAll || seed_select == SS_IndexPostCleaning) {
156  m_seeds.push_back(s);
157  } else if (seed_select == SS_Label && s.label() == selected_seed) {
158  m_seeds.push_back(s);
159  if (--count <= 0)
160  break;
161  } else if (seed_select == SS_IndexPreCleaning && n_algo >= selected_seed) {
162  m_seeds.push_back(s);
163  if (--count <= 0)
164  break;
165  }
166  ++n_algo;
167  } else if (n_algo > 0)
168  break;
169  }
170  }
171 
172  printf("Shell::ProcessEvent running over %d seeds\n", (int) m_seeds.size());
173 
174  // Equivalent to run_OneIteration(...) without MkBuilder::release_memory().
175  // If seed_select == SS_IndexPostCleaning the given seed is picked after cleaning.
176  {
177  const TrackerInfo &trackerInfo = Config::TrkInfo;
178  const EventOfHits &eoh = *m_eoh;
179  const IterationMaskIfcBase &it_mask_ifc = mask_ifc;
182  TrackVec &out_tracks = m_tracks;
183  bool do_seed_clean = m_clean_seeds;
184  bool do_backward_fit = m_backward_fit;
185  bool do_remove_duplicates = m_remove_duplicates;
186 
187  MkJob job({trackerInfo, itconf, eoh, eoh.refBeamSpot(), &it_mask_ifc});
188 
189  builder.begin_event(&job, m_event, __func__);
190 
191  // Seed cleaning not done on all iterations.
192  do_seed_clean = m_clean_seeds && itconf.m_seed_cleaner;
193 
194  if (do_seed_clean) {
195  itconf.m_seed_cleaner(seeds, itconf, eoh.refBeamSpot());
196  printf("Shell::ProcessEvent post seed-cleaning: %d seeds\n", (int) m_seeds.size());
197  } else {
198  printf("Shell::ProcessEvent no seed-cleaning\n");
199  }
200 
201  // Check nans in seeds -- this should not be needed when Slava fixes
202  // the track parameter coordinate transformation.
204 
205  if (seed_select == SS_IndexPostCleaning) {
206  int seed_size = (int) seeds.size();
207  if (selected_seed >= 0 && selected_seed < seed_size) {
208  if (selected_seed + count >= seed_size) {
209  count = seed_size - selected_seed;
210  printf(" -- selected seed_index + count > seed vector size after cleaning -- trimming count to %d\n",
211  count);
212  }
213  for (int i = 0; i < count; ++i)
214  seeds[i] = seeds[selected_seed + i];
215  seeds.resize(count);
216  } else {
217  seeds.clear();
218  }
219  }
220 
221  if (seeds.empty()) {
222  if (seed_select != SS_UseAll)
223  printf("Shell::ProcessEvent requested seed not found among seeds of the selected iteration.\n");
224  else
225  printf("Shell::ProcessEvent no seeds found.\n");
226  return;
227  }
228 
229  if (itconf.m_requires_seed_hit_sorting) {
230  for (auto &s : seeds)
231  s.sortHitsByLayer(); // sort seed hits for the matched hits (I hope it works here)
232  }
233 
235 
236  builder.find_tracks_load_seeds(seeds, do_seed_clean);
237 
239 
240  printf("Shell::ProcessEvent post fwd search: %d comb-cands\n", builder.ref_eocc().size());
241 
242  // Pre backward-fit filtering.
243  filter_candidates_func pre_filter;
244  if (do_backward_fit && itconf.m_pre_bkfit_filter)
245  pre_filter = [&](const TrackCand &tc, const MkJob &jb) -> bool {
246  return itconf.m_pre_bkfit_filter(tc, jb) && StdSeq::qfilter_nan_n_silly<TrackCand>(tc, jb);
247  };
248  else if (itconf.m_pre_bkfit_filter)
249  pre_filter = itconf.m_pre_bkfit_filter;
250  else if (do_backward_fit)
251  pre_filter = StdSeq::qfilter_nan_n_silly<TrackCand>;
252  // pre_filter can be null if we are not doing backward fit as nan_n_silly will be run below.
253  if (pre_filter)
254  builder.filter_comb_cands(pre_filter, true);
255 
256  printf("Shell::ProcessEvent post pre-bkf-filter (%s) and nan-filter (%s) filter: %d comb-cands\n",
257  b2a(bool(itconf.m_pre_bkfit_filter)), b2a(do_backward_fit), builder.ref_eocc().size());
258 
259  job.switch_to_backward();
260 
261  if (do_backward_fit) {
262  if (itconf.m_backward_search) {
264  }
265 
267 
268  if (itconf.m_backward_search) {
271  }
272 
273  printf("Shell::ProcessEvent post backward fit / search: %d comb-cands\n", builder.ref_eocc().size());
274  }
275 
276  // Post backward-fit filtering.
277  filter_candidates_func post_filter;
278  if (do_backward_fit && itconf.m_post_bkfit_filter)
279  post_filter = [&](const TrackCand &tc, const MkJob &jb) -> bool {
280  return itconf.m_post_bkfit_filter(tc, jb) && StdSeq::qfilter_nan_n_silly<TrackCand>(tc, jb);
281  };
282  else
283  post_filter = StdSeq::qfilter_nan_n_silly<TrackCand>;
284  // post_filter is always at least doing nan_n_silly filter.
285  builder.filter_comb_cands(post_filter, true);
286 
287  printf("Shell::ProcessEvent post post-bkf-filter (%s) and nan-filter (true): %d comb-cands\n",
288  b2a(do_backward_fit && itconf.m_post_bkfit_filter), builder.ref_eocc().size());
289 
290  if (do_backward_fit && itconf.m_backward_search)
292 
293  builder.export_best_comb_cands(out_tracks, true);
294 
295  if (do_remove_duplicates && itconf.m_duplicate_cleaner) {
296  itconf.m_duplicate_cleaner(out_tracks, itconf);
297  }
298 
299  printf("Shell::ProcessEvent post remove-duplicates: %d comb-cands\n", (int) out_tracks.size());
300 
301  // Do not clear ... useful for debugging / printouts!
302  // m_event->resetCurrentSeedTracks();
303 
304  builder.end_event();
305  }
306 
307  printf("Shell::ProcessEvent found %d tracks, number of seeds at end %d\n",
308  (int) m_tracks.size(), (int) m_seeds.size());
309  }
310 
311  //===========================================================================
312  // Iteration selection
313  //===========================================================================
314 
315  void Shell::SelectIterationIndex(int itidx) {
316  if (itidx < 0 || itidx >= n_algos) {
317  fprintf(stderr, "Requested iteration index out of range [%d, %d)", 0, n_algos);
318  throw std::runtime_error("iteration index out of range");
319  }
320  m_it_index = itidx;
321  }
322 
324  for (int i = 0; i < n_algos; ++i) {
325  if (algos[i] == algo) {
326  m_it_index = i;
327  return;
328  }
329  }
330  fprintf(stderr, "Requested algo %d not found", algo);
331  throw std::runtime_error("algo not found");
332  }
333 
335  printf("Shell::PrintIterations selected index = %d, %d iterations hardcoded as\n",
336  m_it_index, n_algos);
337  for (int i = 0; i < n_algos; ++i)
338  printf("%d %2d %s\n", i, algos[i], TrackBase::algoint_to_cstr(algos[i]));
339  }
340 
341  //===========================================================================
342  // Flags / status setters
343  //===========================================================================
344 
345  void Shell::SetDebug(bool b) { g_debug = b; }
350 
351  //===========================================================================
352  // Analysis helpers
353  //===========================================================================
354 
355  /*
356  sim tracks are written to .bin files with a label equal to its own index.
357  reco tracks labels are seed indices.
358  seed labels are sim track indices
359  --
360  mkfit labels are seed indices in given iteration after cleaning (at seed load-time).
361  This is no longer true -- was done like that in branch where this code originated from.
362  It seems the label is the same as seed label.
363  */
364 
365  int Shell::LabelFromHits(Track &t, bool replace, float good_frac) {
366  std::map<int, int> lab_cnt;
367  for (int hi = 0; hi < t.nTotalHits(); ++hi) {
368  auto hot = t.getHitOnTrack(hi);
369  if (hot.index < 0)
370  continue;
371  const Hit &h = m_event->layerHits_[hot.layer][hot.index];
372  int hl = m_event->simHitsInfo_[h.mcHitID()].mcTrackID_;
373  if (hl >= 0)
374  ++lab_cnt[hl];
375  }
376  int max_c = -1, max_l = -1;
377  for (auto& x : lab_cnt) {
378  if (x.second > max_c) {
379  max_l = x.first;
380  max_c = x.second;
381  }
382  }
383  bool success = max_c >= good_frac * t.nFoundHits();
384  int relabel = success ? max_l : -1;
385  // printf("found_hits=%d, best_lab %d (%d hits), existing label=%d (replace flag=%s)\n",
386  // t.nFoundHits(), max_l, max_c, t.label(), b2a(replace));
387  if (replace)
388  t.setLabel(relabel);
389  return relabel;
390  }
391 
393  Event &ev = *m_event;
394  const int track_algo = Config::ItrInfo[m_it_index].m_track_algorithm;
395 
396  m_ckf_map.clear();
397  m_sim_map.clear();
398  m_seed_map.clear();
399  m_mkf_map.clear();
400 
401  // Pick ckf tracks with right algo and a good label.
402  int rec_algo_match = 0;
403  for (auto &t : ev.cmsswTracks_) {
404  if (t.algoint() != track_algo)
405  continue;
406  ++rec_algo_match;
407  int label = LabelFromHits(t, false, 0.5);
408  if (label >= 0) {
409  m_ckf_map.insert(std::make_pair(label, &t));
410  }
411  }
412 
413  // Pick sim tracks with labels found by ckf.
414  for (auto &t : ev.simTracks_) {
415  if (t.label() >= 0 && m_ckf_map.find(t.label()) != m_ckf_map.end()) {
416  m_sim_map.insert(std::make_pair(t.label(), &t));
417  }
418  }
419 
420  // Pick seeds with right algo and a label found by ckf.
421  for (auto &t : ev.seedTracks_) {
422  if (t.algoint() == track_algo && t.label() >= 0 && m_ckf_map.find(t.label()) != m_ckf_map.end()) {
423  m_seed_map.insert(std::make_pair(t.label(), &t));
424  }
425  }
426  // Some seeds seem to be labeled -1, try fixing when not otherwise found.
427  for (auto &t : ev.seedTracks_) {
428  if (t.algoint() == track_algo && t.label() == -1) {
429  int lab = LabelFromHits(t, true, 0.5);
430  if (lab >= 0 && m_seed_map.find(lab) == m_seed_map.end()) {
431  if (m_ckf_map.find(lab) != m_ckf_map.end()) {
432  m_seed_map.insert(std::make_pair(t.label(), &t));
433  printf("Saved seed with label -1 -> %d\n", lab);
434  }
435  }
436  }
437  }
438 
439  // Pick mkfit tracks, label by
440  for (auto &t : m_tracks) {
441  int label = LabelFromHits(t, false, 0.5);
442  if (label >= 0) {
443  m_mkf_map.insert(std::make_pair(label, &t));
444  }
445  }
446 
447  printf("Shell::FillByLabelMaps reporting tracks with label >= 0, algo=%d (%s): "
448  "ckf: %d of %d (same algo=%d)), sim: %d of %d, seed: %d of %d, mkfit: %d w/label of %d\n",
449  track_algo, TrackBase::algoint_to_cstr(track_algo),
450  (int) m_ckf_map.size(), (int) ev.cmsswTracks_.size(), rec_algo_match,
451  (int) m_sim_map.size(), (int) ev.simTracks_.size(),
452  (int) m_seed_map.size(), (int) m_seeds.size(),
453  (int) m_mkf_map.size(), (int) m_tracks.size()
454  );
455  }
456 
457  bool Shell::CheckMkFitLayerPlanVsReferenceHits(const Track &mkft, const Track &reft, const std::string &name) {
458  // Check if all hit-layers of a reference track reft are in the mkfit layer plan.
459  // Returns true if all layers are in the plan.
460  // String name is printed in front of label, expected to be SIMK or CKF.
461  const IterationConfig &itconf = Config::ItrInfo[m_it_index];
462  auto lp = itconf.m_steering_params[ mkft.getEtaRegion() ].m_layer_plan;
463  bool ret = true;
464  for (int hi = 0; hi < reft.nTotalHits(); ++hi) {
465  auto hot = reft.getHitOnTrack(hi);
466  if (std::find_if(lp.begin(), lp.end(), [=](auto &x){ return x.m_layer == hot.layer; }) == lp.end())
467  {
468  printf("CheckMkfLayerPlanVsCkfHits: layer %d not in layer plan for region %d, %s label=%d\n",
469  hot.layer, mkft.getEtaRegion(), name.c_str(), reft.label());
470  ret = false;
471  }
472  }
473  return ret;
474  }
475 
476  //===========================================================================
477  // Analysis drivers / main functions / Comparators
478  //===========================================================================
479 
480  void Shell::Compare() {
481  Event &ev = *m_event;
482  const IterationConfig &itconf = Config::ItrInfo[m_it_index];
483 
485 
486  printf("------------------------------------------------------\n");
487 
488  const bool print_all_def = false;
489  int mkf_cnt=0, less_hits=0, more_hits=0;
490 
491  // TOBTEC: look for rec-seeds with hits in tob1 and 2 only.
492  int tot_cnt = 0, no_mkf_cnt = 0;
493 
494  for (auto& [l, simt_ptr]: m_sim_map)
495  {
496  auto &simt = * simt_ptr;
497  auto &ckft = * m_ckf_map[l];
498  auto mi = m_mkf_map.find(l);
499 
500  bool print_all = print_all_def;
501 
502  // TOBTEC: look for rec-seeds with hits in tob1 and 2 only.
503  bool select = true;
504  {
505  auto &ckf_seed = ev.seedTracks_[ckft.label()];
506  for (int hi = 0; hi < ckf_seed.nTotalHits(); ++hi) {
507  const HitOnTrack hot = ckf_seed.getHitOnTrack(hi);
508  if (hot.index >= 0 && (hot.layer < 10 || hot.layer > 13)) {
509  select = false;
510  break;
511  }
512  }
513  }
514  if ( ! select) continue;
515 
516  ++tot_cnt;
517  //print_all = true;
518 
519  if (mi != m_mkf_map.end())
520  {
521  auto &mkft = * mi->second;
522  mkf_cnt++;
523  if (mkft.nFoundHits() < ckft.nFoundHits()) ++less_hits;
524  if (mkft.nFoundHits() > ckft.nFoundHits()) ++more_hits;
525 
526  CheckMkFitLayerPlanVsReferenceHits(mkft, ckft, "CKF");
527  // CheckMkFitLayerPlanVsReferenceHits(mkft, simt, "SIM");
528 
529  (void) print_all;
530  if (/* itconf.m_track_algorithm == 10 ||*/ print_all) {
531  // ckf label is wrong when validation is on (even quality val) for mixedTriplet, pixelless and tobtec
532  // as seed tracks get removed for non-mkfit iterations and indices from rec-tracks are no longer valid.
533  auto &ckf_seed = ev.seedTracks_[ckft.label()];
534  auto &mkf_seed = m_seeds[mkft.label()];
535  print("ckf ", 0, ckft, ev);
536  print("mkfit", 0, mkft, ev);
537  print("sim ", 0, simt, ev);
538  print("ckf seed", 0, ckf_seed, ev);
539  print("mkf seed", 0, mkf_seed, ev);
540  printf("------------------------------------------------------\n");
541 
542  TrackVec ssss;
543  ssss.push_back(mkf_seed);
544 
545  IterationSeedPartition pppp(1);
546  IterationConfig::get_seed_partitioner("phase1:1:debug")(Config::TrkInfo, ssss, *m_eoh, pppp);
547 
548  printf("------------------------------------------------------\n");
549  printf("\n");
550  }
551  }
552  else
553  {
554  printf("\n!!!!! No mkfit track with this label.\n\n");
555  ++no_mkf_cnt;
556 
557  auto &ckf_seed = ev.seedTracks_[ckft.label()];
558  print("ckf ", 0, ckft, ev);
559  print("sim ", 0, simt, ev);
560  print("ckf seed", 0, ckf_seed, ev);
561  auto smi = m_seed_map.find(l);
562  if (smi != m_seed_map.end())
563  print("seed with matching label", 0, *smi->second, ev);
564  printf("------------------------------------------------------\n");
565  }
566  }
567 
568  printf("mkFit found %d, matching_label=%d, less_hits=%d, more_hits=%d [algo=%d (%s)]\n",
569  (int) ev.fitTracks_.size(), mkf_cnt, less_hits, more_hits,
571 
572  if (tot_cnt > 0) {
573  printf("\ntobtec tob1/2 tot=%d no_mkf=%d (%f%%)\n",
574  tot_cnt, no_mkf_cnt, 100.0 * no_mkf_cnt / tot_cnt);
575  } else {
576  printf("\nNo CKF tracks with seed hits in TOB1/2 found (need iteration idx 8, TobTec?)\n");
577  }
578 
579  printf("-------------------------------------------------------------------------------------------\n");
580  printf("-------------------------------------------------------------------------------------------\n");
581  printf("\n");
582  }
583 
584  //===========================================================================
585  // Visualization helpers
586  //===========================================================================
587 
588 #ifdef WITH_REVE
589 
590  void Shell::ShowTracker() {
591  namespace REX = ROOT::Experimental;
592  auto eveMng = REX::REveManager::Create();
593  eveMng->AllowMultipleRemoteConnections(false, false);
594 
595  {
596  REX::REveElement *holder = new REX::REveElement("Jets");
597 
598  int N_Jets = 4;
599  TRandom &r = *gRandom;
600 
601  //const Double_t kR_min = 240;
602  const Double_t kR_max = 250;
603  const Double_t kZ_d = 300;
604  for (int i = 0; i < N_Jets; i++)
605  {
606  auto jet = new REX::REveJetCone(Form("Jet_%d",i ));
607  jet->SetCylinder(2*kR_max, 2*kZ_d);
608  jet->AddEllipticCone(r.Uniform(-0.5, 0.5), r.Uniform(0, TMath::TwoPi()),
609  0.1, 0.2);
610  jet->SetFillColor(kRed + 4);
611  jet->SetLineColor(kBlack);
612  jet->SetMainTransparency(90);
613 
614  holder->AddElement(jet);
615  }
616  eveMng->GetEventScene()->AddElement(holder);
617  }
618 
619  auto &ti = Config::TrkInfo;
620  for (int l = 0; l < ti.n_layers(); ++l) {
621  auto &li = ti[l];
622  auto* bs = new REX::REveBoxSet(Form("Layer %d", l));
623  bs->Reset(REX::REveBoxSet::kBT_InstancedScaledRotated, true, li.n_modules());
624  bs->SetMainColorPtr(new Color_t);
625  bs->UseSingleColor();
626  if (li.is_pixel())
627  bs->SetMainColor(li.is_barrel() ? kBlue - 3 : kCyan - 3);
628  else
629  bs->SetMainColor(li.is_barrel() ? kMagenta - 3 : kGreen - 3);
630 
631  float t[16];
632  t[3] = t[7] = t[11] = 0;
633  t[15] = 1;
634  for (int m = 0; m < li.n_modules(); ++m) {
635  auto &mi = li.module_info(m);
636  auto &si = li.module_shape(mi.shapeid);
637 
638  auto &x = mi.xdir;
639  t[0] = x[0] * si.dx1;
640  t[1] = x[1] * si.dx1;
641  t[2] = x[2] * si.dx1;
642  auto y = mi.calc_ydir();
643  t[4] = y[0] * si.dy;
644  t[5] = y[1] * si.dy;
645  t[6] = y[2] * si.dy;
646  auto &z = mi.zdir;
647  t[8] = z[0] * si.dz;
648  t[9] = z[1] * si.dz;
649  t[10] = z[2] * si.dz;
650  auto &p = mi.pos;
651  t[12] = p[0];
652  t[13] = p[1];
653  t[14] = p[2];
654 
655  bs->AddInstanceMat4(t);
656  }
657  bs->SetMainTransparency(60);
658  bs->RefitPlex();
659 
660  eveMng->GetEventScene()->AddElement(bs);
661  }
662  eveMng->Show();
663  }
664 
665 #endif // WITH_REVE
666 
667 }
const double TwoPi
std::map< int, Track * > m_sim_map
Definition: Shell.h:87
void ProcessEvent(SeedSelect_e seed_select=SS_UseAll, int selected_seed=-1, int count=1)
Definition: Shell.cc:140
const EventOfCombCandidates & ref_eocc() const
Definition: MkBuilder.h:74
Shell(std::vector< DeadVec > &dv, const std::string &in_file, int start_ev)
Definition: Shell.cc:48
TrackVec m_seeds
Definition: Shell.h:81
void rewind()
Definition: Event.cc:1010
int openRead(const std::string &fname, int expected_n_layers)
Definition: Event.cc:922
const BeamSpot & refBeamSpot() const
void reset(int evtID)
Definition: Event.cc:29
void PrintIterations()
Definition: Shell.cc:334
ret
prodAgent to be discontinued
bool m_remove_duplicates
Definition: Shell.h:79
DataFile * m_data_file
Definition: Shell.h:71
void compactifyHitStorageForBestCand(bool remove_seed_hits, int backward_fit_min_hits)
Definition: MkBuilder.h:63
def replace(string, replacements)
int label() const
Definition: Track.h:174
TrackVec seedTracks_
Definition: Event.h:75
void findTracksCloneEngine(SteeringParams::IterationType_e iteration_dir=SteeringParams::IT_FwdSearch)
Definition: MkBuilder.cc:948
int evtID() const
Definition: Event.h:24
std::map< int, Track * > m_mkf_map
Definition: Shell.h:87
bool CheckMkFitLayerPlanVsReferenceHits(const Track &mkft, const Track &reft, const std::string &name)
Definition: Shell.cc:457
bool m_clean_seeds
Definition: Shell.h:77
void SetDebug(bool b)
Definition: Shell.cc:345
void begin_event(MkJob *job, Event *ev, const char *build_type)
Definition: MkBuilder.cc:206
void resetCurrentSeedTracks()
Definition: Event.cc:913
void Status()
Definition: Shell.cc:91
clean_seeds_func m_seed_cleaner
void SelectIterationIndex(int itidx)
Definition: Shell.cc:315
TEMPL(T2) struct Divides void
Definition: Factorize.h:24
EventOfHits * eoh()
Definition: Shell.h:43
void Run()
Definition: Shell.cc:76
char const * label
MkBuilder * m_builder
Definition: Shell.h:74
std::vector< DeadVec > & m_deadvectors
Definition: Shell.h:70
void loadHitsAndBeamSpot(Event &ev, EventOfHits &eoh)
void FillByLabelMaps_CkfBase()
Definition: Shell.cc:392
void skipNEvents(int n_to_skip)
Definition: Event.cc:1037
std::function< filter_candidates_cf > filter_candidates_func
Definition: FunctionTypes.h:28
EventOfHits * m_eoh
Definition: Shell.h:73
bool g_debug
Definition: Debug.cc:2
void find_tracks_load_seeds(const TrackVec &in_seeds, const bool seeds_sorted)
Definition: MkBuilder.cc:621
Definition: EPCuts.h:4
void setCurrentSeedTracks(const TrackVec &seeds)
Definition: Event.cc:864
const TrackVec & seeds() const
Definition: Shell.h:47
static partition_seeds_func get_seed_partitioner(const std::string &name)
void SetCleanSeeds(bool b)
Definition: Shell.cc:346
void GoToEvent(int eid)
Definition: Shell.cc:106
bool m_backward_fit
Definition: Shell.h:78
TrackerInfo TrkInfo
void loadDeads(EventOfHits &eoh, const std::vector< DeadVec > &deadvectors)
Definition: MkStdSeqs.cc:19
void seed_post_cleaning(TrackVec &tv)
Definition: MkBuilder.cc:419
void SetRemoveDuplicates(bool b)
Definition: Shell.cc:348
void fill_hitmask_bool_vectors(int track_algo, std::vector< std::vector< bool >> &layer_masks)
Definition: Event.cc:818
MCHitInfoVec simHitsInfo_
Definition: Event.h:73
IterationsInfo ItrInfo
MkBuilder * builder()
Definition: Shell.h:44
int filter_comb_cands(filter_candidates_func filter, bool attempt_all_cands)
Definition: MkBuilder.cc:313
void NextEvent(int skip=1)
Definition: Shell.cc:136
std::vector< HitVec > layerHits_
Definition: Event.h:71
static const char * algoint_to_cstr(int algo)
Definition: Track.cc:331
TrackVec m_tracks
Definition: Shell.h:82
filter_candidates_func m_post_bkfit_filter
std::vector< Track > TrackVec
int getEtaRegion() const
Definition: Track.h:263
clean_duplicates_func m_duplicate_cleaner
void beginBkwSearch()
Definition: MkBuilder.h:67
void print(std::string_view label, const MeasurementState &s)
Definition: Hit.cc:8
double b
Definition: hdecay.h:120
int nTotalHits() const
Definition: Track.h:512
void export_best_comb_cands(TrackVec &out_vec, bool remove_missing_hits=false)
Definition: MkBuilder.cc:396
Event * m_event
Definition: Shell.h:72
void SetBackwardFit(bool b)
Definition: Shell.cc:347
int m_it_index
Definition: Shell.h:76
float x
int LabelFromHits(Track &t, bool replace, float good_frac)
Definition: Shell.cc:365
void endBkwSearch()
Definition: MkBuilder.h:68
void Compare()
Definition: Shell.cc:480
void SetUseDeadModules(bool b)
Definition: Shell.cc:349
std::vector< std::vector< bool > > m_mask_vector
void SelectIterationAlgo(int algo)
Definition: Shell.cc:323
filter_candidates_func m_pre_bkfit_filter
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
std::map< int, Track * > m_ckf_map
Definition: Shell.h:87
std::vector< SteeringParams > m_steering_params
int m_evs_in_file
Definition: Shell.h:75
SeedSelect_e
Definition: Shell.h:20
std::map< int, Track * > m_seed_map
Definition: Shell.h:87
void read_in(DataFile &data_file, FILE *in_fp=0)
Definition: Event.cc:203
TrackerInfo * tracker_info()
Definition: Shell.cc:100
HitOnTrack getHitOnTrack(int posHitIdx) const
Definition: Track.h:448