CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes | Static Public Attributes | Private Attributes
mkfit::Event Class Reference

#include <Event.h>

Public Member Functions

int clean_cms_seedtracks (TrackVec *seed_ptr=nullptr)
 
int clean_cms_seedtracks_badlabel ()
 
int clean_cms_simtracks ()
 
 Event (int evtID, int nLayers)
 
 Event (Validation &v, int evtID, int nLayers)
 
int evtID () const
 
void fill_hitmask_bool_vectors (int track_algo, std::vector< std::vector< bool >> &layer_masks)
 
void fill_hitmask_bool_vectors (std::vector< int > &track_algo_vec, std::vector< std::vector< bool >> &layer_masks)
 
void kludge_cms_hit_errors ()
 
void print_tracks (const TrackVec &tracks, bool print_hits) const
 
void printStats (const TrackVec &, TrackExtraVec &)
 
void read_in (DataFile &data_file, FILE *in_fp=0)
 
int read_tracks (FILE *fp, TrackVec &tracks, bool skip_reading=false)
 
void relabel_bad_seedtracks ()
 
void relabel_cmsswtracks_from_seeds ()
 
void reset (int evtID)
 
void resetLayerHitMap (bool resetSimHits)
 
int select_tracks_iter (unsigned int n=0)
 
void setInputFromCMSSW (std::vector< HitVec > hits, TrackVec seeds)
 
int use_seeds_from_cmsswtracks ()
 
void validate ()
 
void write_out (DataFile &data_file)
 
int write_tracks (FILE *fp, const TrackVec &tracks)
 

Public Attributes

BeamSpot beamSpot_
 
TrackVec candidateTracks_
 
TrackExtraVec candidateTracksExtra_
 
TrackVec cmsswTracks_
 
TrackExtraVec cmsswTracksExtra_
 
TrackVec fitTracks_
 
TrackExtraVec fitTracksExtra_
 
std::vector< std::vector
< uint64_t > > 
layerHitMasks_
 
std::vector< HitVeclayerHits_
 
TrackVec seedTracks_
 
TrackExtraVec seedTracksExtra_
 
MCHitInfoVec simHitsInfo_
 
TrackVec simTracks_
 
TrackExtraVec simTracksExtra_
 
TSVec simTrackStates_
 
Validationvalidation_
 

Static Public Attributes

static std::mutex printmutex
 

Private Attributes

int evtID_
 

Detailed Description

Definition at line 14 of file Event.h.

Constructor & Destructor Documentation

Event::Event ( int  evtID,
int  nLayers 
)
explicit

Definition at line 21 of file Event.cc.

References layerHitMasks_, and layerHits_.

21  : validation_(*dummyValidation), evtID_(evtID) {
22  layerHits_.resize(nLayers);
23  layerHitMasks_.resize(nLayers);
24  }
Validation & validation_
Definition: Event.h:50
int evtID() const
Definition: Event.h:23
constexpr int nLayers
Definition: Config.h:73
std::vector< HitVec > layerHits_
Definition: Event.h:57
int evtID_
Definition: Event.h:53
std::vector< std::vector< uint64_t > > layerHitMasks_
Definition: Event.h:58
Event::Event ( Validation v,
int  evtID,
int  nLayers 
)

Definition at line 26 of file Event.cc.

References layerHitMasks_, layerHits_, mkfit::Validation::resetValidationMaps(), and validation_.

26  : validation_(v), evtID_(evtID) {
27  layerHits_.resize(nLayers);
28  layerHitMasks_.resize(nLayers);
29  validation_.resetValidationMaps(); // need to reset maps for every event.
30  }
Validation & validation_
Definition: Event.h:50
virtual void resetValidationMaps()
Definition: Validation.h:50
int evtID() const
Definition: Event.h:23
constexpr int nLayers
Definition: Config.h:73
std::vector< HitVec > layerHits_
Definition: Event.h:57
int evtID_
Definition: Event.h:53
std::vector< std::vector< uint64_t > > layerHitMasks_
Definition: Event.h:58

Member Function Documentation

int Event::clean_cms_seedtracks ( TrackVec seed_ptr = nullptr)

Definition at line 578 of file Event.cc.

References funct::abs(), mkfit::Config::c_dpt_common, mkfit::Config::c_drmax_brl, mkfit::Config::c_drmax_els, mkfit::Config::c_drmax_hpt, mkfit::Config::c_dzmax_brl, mkfit::Config::c_dzmax_els, mkfit::Config::c_dzmax_hpt, mkfit::Config::c_etamax_brl, mkfit::Config::c_ptmin_hpt, mkfit::cdist(), RecoTauCleanerPlugins::charge, mkfit::TrackBase::charge(), PVValHelper::eta, validate-o2o-wbm::f, mkfit::TrackBase::invpT(), mkfit::TrackBase::label(), mkfit::TrackBase::momEta(), mkfit::TrackBase::momPhi(), mkfit::Track::nFoundHits(), nHits, funct::pow(), gpuVertexFinder::printf(), DiDispStaMuonMonitor_cfi::pt, mkfit::TrackBase::pT(), DetachedQuadStep_cff::seeds, seedTracks_, mathSSE::sqrt(), contentValuesCheck::ss, funct::tan(), mkfit::TrackBase::theta(), mkfit::Config::track1GeVradius, mkfit::TrackBase::x(), mkfit::TrackBase::y(), and mkfit::TrackBase::z().

578  {
579  const float etamax_brl = Config::c_etamax_brl;
580  const float dpt_common = Config::c_dpt_common;
581  const float dzmax_brl = Config::c_dzmax_brl;
582  const float drmax_brl = Config::c_drmax_brl;
583  const float ptmin_hpt = Config::c_ptmin_hpt;
584  const float dzmax_hpt = Config::c_dzmax_hpt;
585  const float drmax_hpt = Config::c_drmax_hpt;
586  const float dzmax_els = Config::c_dzmax_els;
587  const float drmax_els = Config::c_drmax_els;
588 
589  const float dzmax2_inv_brl = 1.f / (dzmax_brl * dzmax_brl);
590  const float drmax2_inv_brl = 1.f / (drmax_brl * drmax_brl);
591  const float dzmax2_inv_hpt = 1.f / (dzmax_hpt * dzmax_hpt);
592  const float drmax2_inv_hpt = 1.f / (drmax_hpt * drmax_hpt);
593  const float dzmax2_inv_els = 1.f / (dzmax_els * dzmax_els);
594  const float drmax2_inv_els = 1.f / (drmax_els * drmax_els);
595 
596  TrackVec &seeds = (seed_ptr != nullptr) ? *seed_ptr : seedTracks_;
597  const int ns = seeds.size();
598 
599  TrackVec cleanSeedTracks;
600  cleanSeedTracks.reserve(ns);
601  std::vector<bool> writetrack(ns, true);
602 
603  const float invR1GeV = 1.f / Config::track1GeVradius;
604 
605  std::vector<int> nHits(ns);
606  std::vector<int> charge(ns);
607  std::vector<float> oldPhi(ns);
608  std::vector<float> pos2(ns);
609  std::vector<float> eta(ns);
610  std::vector<float> ctheta(ns);
611  std::vector<float> invptq(ns);
612  std::vector<float> pt(ns);
613  std::vector<float> x(ns);
614  std::vector<float> y(ns);
615  std::vector<float> z(ns);
616 
617  for (int ts = 0; ts < ns; ts++) {
618  const Track &tk = seeds[ts];
619  nHits[ts] = tk.nFoundHits();
620  charge[ts] = tk.charge();
621  oldPhi[ts] = tk.momPhi();
622  pos2[ts] = std::pow(tk.x(), 2) + std::pow(tk.y(), 2);
623  eta[ts] = tk.momEta();
624  ctheta[ts] = 1.f / std::tan(tk.theta());
625  invptq[ts] = tk.charge() * tk.invpT();
626  pt[ts] = tk.pT();
627  x[ts] = tk.x();
628  y[ts] = tk.y();
629  z[ts] = tk.z();
630  }
631 
632  for (int ts = 0; ts < ns; ts++) {
633  if (not writetrack[ts])
634  continue; //FIXME: this speed up prevents transitive masking; check build cost!
635 
636  const float oldPhi1 = oldPhi[ts];
637  const float pos2_first = pos2[ts];
638  const float Eta1 = eta[ts];
639  const float Pt1 = pt[ts];
640  const float invptq_first = invptq[ts];
641 
642  //#pragma simd /* Vectorization via simd had issues with icc */
643  for (int tss = ts + 1; tss < ns; tss++) {
644  const float Pt2 = pt[tss];
645 
647  if (charge[tss] != charge[ts])
648  continue;
649 
650  const float thisDPt = std::abs(Pt2 - Pt1);
652  if (thisDPt > dpt_common * (Pt1))
653  continue;
654 
655  const float Eta2 = eta[tss];
656  const float deta2 = std::pow(Eta1 - Eta2, 2);
657 
658  const float oldPhi2 = oldPhi[tss];
659 
660  const float pos2_second = pos2[tss];
661  const float thisDXYSign05 = pos2_second > pos2_first ? -0.5f : 0.5f;
662 
663  const float thisDXY = thisDXYSign05 * sqrt(std::pow(x[ts] - x[tss], 2) + std::pow(y[ts] - y[tss], 2));
664 
665  const float invptq_second = invptq[tss];
666 
667  const float newPhi1 = oldPhi1 - thisDXY * invR1GeV * invptq_first;
668  const float newPhi2 = oldPhi2 + thisDXY * invR1GeV * invptq_second;
669 
670  const float dphi = cdist(std::abs(newPhi1 - newPhi2));
671 
672  const float dr2 = deta2 + dphi * dphi;
673 
674  const float thisDZ = z[ts] - z[tss] - thisDXY * (ctheta[ts] + ctheta[tss]);
675  const float dz2 = thisDZ * thisDZ;
676 
679  if (std::abs(Eta1) < etamax_brl) {
680  if (dz2 * dzmax2_inv_brl + dr2 * drmax2_inv_brl < 1.0f)
681  writetrack[tss] = false;
682  } else if (Pt1 > ptmin_hpt) {
683  if (dz2 * dzmax2_inv_hpt + dr2 * drmax2_inv_hpt < 1.0f)
684  writetrack[tss] = false;
685  } else {
686  if (dz2 * dzmax2_inv_els + dr2 * drmax2_inv_els < 1.0f)
687  writetrack[tss] = false;
688  }
689  }
690 
691  if (writetrack[ts])
692  cleanSeedTracks.emplace_back(seeds[ts]);
693  }
694 
695  seeds.swap(cleanSeedTracks);
696 
697 #ifdef DEBUG
698  {
699  const int ns2 = seeds.size();
700  printf("Number of CMS seeds before %d --> after %d cleaning\n", ns, ns2);
701 
702  for (int it = 0; it < ns2; it++) {
703  const Track &ss = seeds[it];
704  printf(" %3i q=%+i pT=%7.3f eta=% 7.3f nHits=%i label=% i\n",
705  it,
706  ss.charge(),
707  ss.pT(),
708  ss.momEta(),
709  ss.nFoundHits(),
710  ss.label());
711  }
712  }
713 #endif
714 
715  return seeds.size();
716  }
constexpr float c_drmax_els
Definition: Config.h:135
constexpr float c_dpt_common
Definition: Config.h:128
TrackVec seedTracks_
Definition: Event.h:61
constexpr float c_dzmax_hpt
Definition: Config.h:132
constexpr float c_etamax_brl
Definition: Config.h:127
constexpr float c_ptmin_hpt
Definition: Config.h:131
T sqrt(T t)
Definition: SSEVec.h:19
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float cdist(float a)
Definition: Config.h:67
std::vector< Track > TrackVec
constexpr float track1GeVradius
Definition: Config.h:126
constexpr float c_dzmax_els
Definition: Config.h:134
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
constexpr float c_dzmax_brl
Definition: Config.h:129
constexpr float c_drmax_hpt
Definition: Config.h:133
constexpr float c_drmax_brl
Definition: Config.h:130
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
int Event::clean_cms_seedtracks_badlabel ( )

Definition at line 754 of file Event.cc.

References visDQMUpload::buf, gpuVertexFinder::printf(), seedTracks_, and submitPVValidationJobs::t.

754  {
755  printf("***\n*** REMOVING SEEDS WITH BAD LABEL. This is a development hack. ***\n***\n");
756  TrackVec buf;
757  seedTracks_.swap(buf);
758  std::copy_if(
759  buf.begin(), buf.end(), std::back_inserter(seedTracks_), [](const Track &t) { return t.label() >= 0; });
760  return seedTracks_.size();
761  }
TrackVec seedTracks_
Definition: Event.h:61
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
std::vector< Track > TrackVec
int Event::clean_cms_simtracks ( )

Definition at line 497 of file Event.cc.

References mkfit::Config::cmsSelMinLayers, dprintf, mps_fire::i, simTracks_, and submitPVValidationJobs::t.

497  {
498  // Sim tracks from cmssw have the following issues:
499  // - hits are not sorted by layer;
500  // - there are tracks with too low number of hits, even 0;
501  // - even with enough hits, there can be too few layers (esp. in endcap);
502  // - tracks from secondaries can have extremely low pT.
503  // Possible further checks:
504  // - make sure enough hits exist in seeding layers.
505  //
506  // What is done:
507  // 1. Hits are sorted by layer;
508  // 2. Non-findable tracks are marked with Track::Status::not_findable flag.
509  //
510  // Returns number of passed simtracks.
511 
512  dprintf("Event::clean_cms_simtracks processing %lu simtracks.\n", simTracks_.size());
513 
514  int n_acc = 0;
515  int i = -1; //wrap in ifdef DEBUG?
516  for (Track &t : simTracks_) {
517  i++;
518 
519  t.sortHitsByLayer();
520 
521  const int lyr_cnt = t.nUniqueLayers();
522 
523  //const int lasthit = t.getLastFoundHitPos();
524  //const float eta = layerHits_[t.getHitLyr(lasthit)][t.getHitIdx(lasthit)].eta();
525 
526  if (lyr_cnt < Config::cmsSelMinLayers) // || Config::TrkInfo.is_transition(eta))
527  {
528  dprintf("Rejecting simtrack %d, n_hits=%d, n_layers=%d, pT=%f\n", i, t.nFoundHits(), lyr_cnt, t.pT());
529  t.setNotFindable();
530  } else {
531  dprintf("Accepting simtrack %d, n_hits=%d, n_layers=%d, pT=%f\n", i, t.nFoundHits(), lyr_cnt, t.pT());
532  ++n_acc;
533  }
534  }
535 
536  return n_acc;
537  }
TrackVec simTracks_
Definition: Event.h:61
#define dprintf(...)
Definition: Debug.h:93
int mkfit::Event::evtID ( ) const
inline
void Event::fill_hitmask_bool_vectors ( int  track_algo,
std::vector< std::vector< bool >> &  layer_masks 
)

Definition at line 805 of file Event.cc.

References mps_fire::i, cmsLHEtoEOSManager::l, layerHitMasks_, layerHits_, and findQualityFiles::size.

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

805  {
806  // Convert from per-hit uint64_t to per layer bool-vectors for given
807  // iteration.
808 
809  uint64_t iter_mask = 1 << track_algo;
810 
811  const int n_lay = (int)layerHits_.size();
812  layer_masks.resize(n_lay);
813 
814  for (int l = 0; l < n_lay; ++l) {
815  const int n_hit = (int)layerHits_[l].size();
816  layer_masks[l].resize(n_hit);
817 
818  for (int i = 0; i < n_hit; ++i) {
819  layer_masks[l][i] = layerHitMasks_[l][i] & iter_mask;
820  }
821  }
822  }
std::vector< HitVec > layerHits_
Definition: Event.h:57
unsigned long long uint64_t
Definition: Time.h:13
tuple size
Write out results.
std::vector< std::vector< uint64_t > > layerHitMasks_
Definition: Event.h:58
void Event::fill_hitmask_bool_vectors ( std::vector< int > &  track_algo_vec,
std::vector< std::vector< bool >> &  layer_masks 
)

Definition at line 824 of file Event.cc.

References mps_fire::i, cmsLHEtoEOSManager::l, layerHitMasks_, layerHits_, and findQualityFiles::size.

824  {
825  // Convert from per-hit uint64_t to per layer bool-vectors for a list of
826  // iterations.
827  // A hit mask is set if it is set for _all_ listed iterations.
828 
829  uint64_t iter_mask = 0;
830  for (auto ta : track_algo_vec)
831  iter_mask |= 1 << ta;
832 
833  const int n_lay = (int)layerHits_.size();
834  layer_masks.resize(n_lay);
835 
836  for (int l = 0; l < n_lay; ++l) {
837  const int n_hit = (int)layerHits_[l].size();
838  layer_masks[l].resize(n_hit);
839 
840  for (int i = 0; i < n_hit; ++i) {
841  uint64_t hitmasks = layerHitMasks_[l][i];
842  layer_masks[l][i] = ((iter_mask ^ hitmasks) & iter_mask) == 0;
843  }
844  }
845  }
std::vector< HitVec > layerHits_
Definition: Event.h:57
unsigned long long uint64_t
Definition: Time.h:13
tuple size
Write out results.
std::vector< std::vector< uint64_t > > layerHitMasks_
Definition: Event.h:58
void Event::kludge_cms_hit_errors ( )

Definition at line 462 of file Event.cc.

References c, alignCSCRings::e, relativeConstraints::empty, h, layerHits_, and gpuVertexFinder::printf().

Referenced by read_in().

462  {
463  // Enforce Vxy on all layers, Vz on pixb only.
464 
465  const float Exy = 15 * 1e-4, Vxy = Exy * Exy;
466  const float Ez = 30 * 1e-4, Vz = Ez * Ez;
467 
468  int nl = layerHits_.size();
469 
470  int cnt = 0;
471 
472  for (int il = 0; il < nl; il++) {
473  if (layerHits_[il].empty())
474  continue;
475 
476  for (Hit &h : layerHits_[il]) {
477  SVector6 &c = h.error_nc();
478 
479  float vxy = c[0] + c[2];
480  if (vxy < Vxy) {
481  c[0] *= Vxy / vxy;
482  c[2] *= Vxy / vxy;
483  ++cnt;
484  }
485  if (il < 4 && c[5] < Vz) {
486  c[5] = Vz;
487  ++cnt;
488  }
489  }
490  }
491 
492  printf("Event::kludge_cms_hit_errors processed %d layers, kludged %d entries.\n", nl, cnt);
493  }
const edm::EventSetup & c
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
std::vector< HitVec > layerHits_
Definition: Event.h:57
ROOT::Math::SVector< float, 6 > SVector6
Definition: MatrixSTypes.h:10
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
void Event::print_tracks ( const TrackVec tracks,
bool  print_hits 
) const

Definition at line 539 of file Event.cc.

References mkfit::TrackBase::charge(), mkfit::TrackBase::chi2(), mkfit::Track::getHitIdx(), mkfit::Track::getHitLyr(), mkfit::getScoreCand(), mkfit::TrackBase::isFindable(), mkfit::TrackBase::label(), layerHits_, mkfit::Hit::mcHitID(), mkfit::Hit::mcTrackID(), mkfit::TrackBase::momEta(), mkfit::Track::nFoundHits(), nt, mkfit::Track::nTotalHits(), gpuVertexFinder::printf(), mkfit::TrackBase::pT(), alignCSCRings::r, simHitsInfo_, and submitPVValidationJobs::t.

539  {
540  const int nt = tracks.size();
541 
542  //WARNING: Printouts for hits will not make any sense if mkFit is not run with a validation flag such as --quality-val
543  printf("Event::print_tracks printing %d tracks %s hits:\n", nt, (print_hits ? "with" : "without"));
544  for (int it = 0; it < nt; it++) {
545  const Track &t = tracks[it];
546  printf(" %i with q=%+i pT=%7.3f eta=% 7.3f nHits=%2d label=%4d findable=%d score=%7.3f chi2=%7.3f\n",
547  it,
548  t.charge(),
549  t.pT(),
550  t.momEta(),
551  t.nFoundHits(),
552  t.label(),
553  t.isFindable(),
554  getScoreCand(t),
555  t.chi2());
556 
557  if (print_hits) {
558  for (int ih = 0; ih < t.nTotalHits(); ++ih) {
559  int lyr = t.getHitLyr(ih);
560  int idx = t.getHitIdx(ih);
561  if (idx >= 0) {
562  const Hit &hit = layerHits_[lyr][idx];
563  printf(" hit %2d lyr=%2d idx=%3d pos r=%7.3f z=% 8.3f mc_hit=%3d mc_trk=%3d\n",
564  ih,
565  lyr,
566  idx,
567  layerHits_[lyr][idx].r(),
568  layerHits_[lyr][idx].z(),
569  hit.mcHitID(),
570  hit.mcTrackID(simHitsInfo_));
571  } else
572  printf(" hit %2d lyr=%2d idx=%3d\n", ih, t.getHitLyr(ih), t.getHitIdx(ih));
573  }
574  }
575  }
576  }
auto const & tracks
cannot be loose
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
MCHitInfoVec simHitsInfo_
Definition: Event.h:59
int nt
Definition: AMPTWrapper.h:42
std::vector< HitVec > layerHits_
Definition: Event.h:57
float getScoreCand(const TrackCand &cand1, bool penalizeTailMissHits=false, bool inFindCandidates=false)
void Event::printStats ( const TrackVec trks,
TrackExtraVec trkextras 
)

Definition at line 90 of file Event.cc.

References gather_cfg::cout, newFWLiteAna::found, layerHits_, simHitsInfo_, and simTracks_.

90  {
91  int miss(0), found(0), fp_10(0), fp_20(0), hit8(0), h8_10(0), h8_20(0);
92 
93  for (auto &&trk : trks) {
94  auto &&extra = trkextras[trk.label()];
95  extra.setMCTrackIDInfo(trk, layerHits_, simHitsInfo_, simTracks_, false, true);
96  if (extra.mcTrackID() < 0) {
97  ++miss;
98  } else {
99  auto &&mctrk = simTracks_[extra.mcTrackID()];
100  auto pr = trk.pT() / mctrk.pT();
101  found++;
102  bool h8 = trk.nFoundHits() >= 8;
103  bool pt10 = pr > 0.9 && pr < 1.1;
104  bool pt20 = pr > 0.8 && pr < 1.2;
105  fp_10 += pt10;
106  fp_20 += pt20;
107  hit8 += h8;
108  h8_10 += h8 && pt10;
109  h8_20 += h8 && pt20;
110  }
111  }
112  std::cout << "found tracks=" << found << " in pT 10%=" << fp_10 << " in pT 20%=" << fp_20
113  << " no_mc_assoc=" << miss << std::endl
114  << " nH >= 8 =" << hit8 << " in pT 10%=" << h8_10 << " in pT 20%=" << h8_20 << std::endl;
115  }
MCHitInfoVec simHitsInfo_
Definition: Event.h:59
std::vector< HitVec > layerHits_
Definition: Event.h:57
TrackVec simTracks_
Definition: Event.h:61
tuple cout
Definition: gather_cfg.py:144
void Event::read_in ( DataFile data_file,
FILE *  in_fp = 0 
)

Definition at line 206 of file Event.cc.

References mkfit::DataFile::advancePosToNextEvent(), mkfit::TrackBase::algorithm(), beamSpot_, mkfit::TrackBase::charge(), mkfit::cmsswSeeds, cmsswTracks_, relativeConstraints::empty, mkfit::Hit::exx(), mkfit::Hit::eyy(), mkfit::Hit::ezz(), mkfit::DataFile::f_fp, personalPlayback::fp, mkfit::Track::getHitIdx(), mkfit::Track::getHitLyr(), mkfit::DataFile::hasBeamSpot(), mkfit::DataFile::hasCmsswTracks(), mkfit::DataFile::hasHitIterMasks(), mkfit::DataFile::hasSeeds(), mkfit::DataFile::hasSimTrackStates(), kludge_cms_hit_errors(), mkfit::Config::kludgeCmsHitErrors, mkfit::TrackBase::label(), layerHitMasks_, layerHits_, mkfit::Hit::mcHitID(), mkfit::Hit::mcTrackID(), mkfit::TrackBase::momEta(), mkfit::Track::nFoundHits(), cms::cuda::nh, nt, mkfit::Track::nTotalHits(), mkfit::Config::nTracks, gpuVertexFinder::printf(), mkfit::TrackBase::pT(), alignCSCRings::r, mkfit::Hit::r(), read_tracks(), mkfit::Config::readCmsswTracks, mkfit::Config::seedInput, seedTracks_, mkfit::Config::silent, simHitsInfo_, simTracks_, simTrackStates_, findQualityFiles::size, mathSSE::sqrt(), contentValuesCheck::ss, submitPVValidationJobs::t, mkfit::Hit::x(), mkfit::Hit::y(), and mkfit::Hit::z().

206  {
207  FILE *fp = in_fp ? in_fp : data_file.f_fp;
208 
209  data_file.advancePosToNextEvent(fp);
210 
211  int nt = read_tracks(fp, simTracks_);
213 
214  if (data_file.hasSimTrackStates()) {
215  int nts;
216  fread(&nts, sizeof(int), 1, fp);
217  simTrackStates_.resize(nts);
218  fread(&simTrackStates_[0], sizeof(TrackState), nts, fp);
219  }
220 
221  int nl;
222  fread(&nl, sizeof(int), 1, fp);
223  layerHits_.resize(nl);
224  layerHitMasks_.resize(nl);
225  for (int il = 0; il < nl; ++il) {
226  int nh;
227  fread(&nh, sizeof(int), 1, fp);
228  layerHits_[il].resize(nh);
229  layerHitMasks_[il].resize(nh, 0); //init to 0 by default
230  fread(&layerHits_[il][0], sizeof(Hit), nh, fp);
231  }
232 
233  if (data_file.hasHitIterMasks()) {
234  for (int il = 0; il < nl; ++il) {
235  int nh = layerHits_[il].size();
236  fread(&layerHitMasks_[il][0], sizeof(uint64_t), nh, fp);
237  }
238  }
239 
240  int nm;
241  fread(&nm, sizeof(int), 1, fp);
242  simHitsInfo_.resize(nm);
243  fread(&simHitsInfo_[0], sizeof(MCHitInfo), nm, fp);
244 
245  if (data_file.hasSeeds()) {
247  (void)ns;
248 
249 #ifdef DUMP_SEEDS
250  printf("Read %i seedtracks (neg value means actual reading was skipped)\n", ns);
251  for (int it = 0; it < ns; it++) {
252  const Track &ss = seedTracks_[it];
253  printf(" %3i q=%+i pT=%7.3f eta=% 7.3f nHits=%i label=%4i algo=%2i\n",
254  it,
255  ss.charge(),
256  ss.pT(),
257  ss.momEta(),
258  ss.nFoundHits(),
259  ss.label(),
260  (int)ss.algorithm());
261 #ifdef DUMP_SEED_HITS
262  for (int ih = 0; ih < seedTracks_[it].nTotalHits(); ++ih) {
263  int lyr = seedTracks_[it].getHitLyr(ih);
264  int idx = seedTracks_[it].getHitIdx(ih);
265  if (idx >= 0) {
266  const Hit &hit = layerHits_[lyr][idx];
267  printf(" hit %2d lyr=%3d idx=%4d pos r=%7.3f z=% 8.3f mc_hit=%3d mc_trk=%3d\n",
268  ih,
269  lyr,
270  idx,
271  layerHits_[lyr][idx].r(),
272  layerHits_[lyr][idx].z(),
273  hit.mcHitID(),
274  hit.mcTrackID(simHitsInfo_));
275  } else
276  printf(" hit %2d idx=%i\n", ih, seedTracks_[it].getHitIdx(ih));
277  }
278 #endif
279  }
280 #endif
281  }
282 
283  int nert = -99999;
284  if (data_file.hasCmsswTracks()) {
286  (void)nert;
287  }
288 
289  /*
290  // HACK TO ONLY SELECT ONE PROBLEMATIC TRACK.
291  // Note that MC matching gets screwed.
292  // Works for MC seeding.
293  //
294  printf("************** SIM SELECTION HACK IN FORCE ********************\n");
295  TrackVec x;
296  x.push_back(simTracks_[3]);
297  simTracks_.swap(x);
298  nt = 1;
299  */
300 
301 #ifdef DUMP_TRACKS
302  printf("Read %i simtracks\n", nt);
303  for (int it = 0; it < nt; it++) {
304  const Track &t = simTracks_[it];
305  printf(" %3i q=%+i pT=%7.3f eta=% 7.3f nHits=%2d label=%4d\n",
306  it,
307  t.charge(),
308  t.pT(),
309  t.momEta(),
310  t.nFoundHits(),
311  t.label());
312 #ifdef DUMP_TRACK_HITS
313  for (int ih = 0; ih < t.nTotalHits(); ++ih) {
314  int lyr = t.getHitLyr(ih);
315  int idx = t.getHitIdx(ih);
316  if (idx >= 0) {
317  const Hit &hit = layerHits_[lyr][idx];
318  printf(" hit %2d lyr=%2d idx=%3d pos r=%7.3f x=% 8.3f y=% 8.3f z=% 8.3f mc_hit=%3d mc_trk=%3d\n",
319  ih,
320  lyr,
321  idx,
322  layerHits_[lyr][idx].r(),
323  layerHits_[lyr][idx].x(),
324  layerHits_[lyr][idx].y(),
325  layerHits_[lyr][idx].z(),
326  hit.mcHitID(),
327  hit.mcTrackID(simHitsInfo_));
328  } else
329  printf(" hit %2d idx=%i\n", ih, t.getHitIdx(ih));
330  }
331 #endif
332  }
333 #endif
334 #ifdef DUMP_LAYER_HITS
335  printf("Read %i layers\n", nl);
336  int total_hits = 0;
337  for (int il = 0; il < nl; il++) {
338  if (layerHits_[il].empty())
339  continue;
340 
341  printf("Read %i hits in layer %i\n", (int)layerHits_[il].size(), il);
342  total_hits += layerHits_[il].size();
343  for (int ih = 0; ih < (int)layerHits_[il].size(); ih++) {
344  const Hit &hit = layerHits_[il][ih];
345  printf(" mcHitID=%5d r=%10g x=%10g y=%10g z=%10g sx=%10.4g sy=%10.4e sz=%10.4e\n",
346  hit.mcHitID(),
347  hit.r(),
348  hit.x(),
349  hit.y(),
350  hit.z(),
351  std::sqrt(hit.exx()),
352  std::sqrt(hit.eyy()),
353  std::sqrt(hit.ezz()));
354  }
355  }
356  printf("Total hits in all layers = %d\n", total_hits);
357 #endif
358 #ifdef DUMP_REC_TRACKS
359  printf("Read %i rectracks\n", nert);
360  for (int it = 0; it < nert; it++) {
361  const Track &t = cmsswTracks_[it];
362  printf(" %i with q=%+i pT=%7.3f eta=% 7.3f nHits=%2d label=%4d algo=%2d\n",
363  it,
364  t.charge(),
365  t.pT(),
366  t.momEta(),
367  t.nFoundHits(),
368  t.label(),
369  (int)t.algorithm());
370 #ifdef DUMP_REC_TRACK_HITS
371  for (int ih = 0; ih < t.nTotalHits(); ++ih) {
372  int lyr = t.getHitLyr(ih);
373  int idx = t.getHitIdx(ih);
374  if (idx >= 0) {
375  const Hit &hit = layerHits_[lyr][idx];
376  printf(" hit %2d lyr=%2d idx=%3d pos r=%7.3f z=% 8.3f mc_hit=%3d mc_trk=%3d\n",
377  ih,
378  lyr,
379  idx,
380  hit.r(),
381  hit.z(),
382  hit.mcHitID(),
383  hit.mcTrackID(simHitsInfo_));
384  } else
385  printf(" hit %2d idx=%i\n", ih, t.getHitIdx(ih));
386  }
387 #endif
388  }
389 #endif
390 
391  if (data_file.hasBeamSpot()) {
392  fread(&beamSpot_, sizeof(BeamSpot), 1, fp);
393  }
394 
397  }
398 
399  if (!Config::silent)
400  printf("Read complete, %d simtracks on file.\n", nt);
401  }
void kludge_cms_hit_errors()
Definition: Event.cc:462
double z
global z - AlignmentGeometry::z0, mm
Definition: HitCollection.h:27
TrackVec cmsswTracks_
Definition: Event.h:62
TrackVec seedTracks_
Definition: Event.h:61
BeamSpot beamSpot_
Definition: Event.h:56
T sqrt(T t)
Definition: SSEVec.h:19
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
uint32_t nh
MCHitInfoVec simHitsInfo_
Definition: Event.h:59
int nt
Definition: AMPTWrapper.h:42
std::vector< HitVec > layerHits_
Definition: Event.h:57
TrackVec simTracks_
Definition: Event.h:61
TSVec simTrackStates_
Definition: Event.h:67
unsigned long long uint64_t
Definition: Time.h:13
int read_tracks(FILE *fp, TrackVec &tracks, bool skip_reading=false)
Definition: Event.cc:429
tuple size
Write out results.
std::vector< std::vector< uint64_t > > layerHitMasks_
Definition: Event.h:58
int Event::read_tracks ( FILE *  fp,
TrackVec tracks,
bool  skip_reading = false 
)

Definition at line 429 of file Event.cc.

References mps_fire::i.

Referenced by read_in().

429  {
430  // Returns number of read tracks (negative if actual reading was skipped).
431 
432  int n_tracks, data_size;
433  fread(&n_tracks, sizeof(int), 1, fp);
434  fread(&data_size, sizeof(int), 1, fp);
435 
436  if (skip_reading) {
437  fseek(fp, data_size - 2 * sizeof(int), SEEK_CUR); // -2 because data_size counts itself and n_tracks too
438  n_tracks = -n_tracks;
439  } else {
440  tracks.resize(n_tracks);
441 
442  fread(tracks.data(), sizeof(Track), n_tracks, fp);
443 
444  for (int i = 0; i < n_tracks; ++i) {
445  tracks[i].resizeHitsForInput();
446  fread(tracks[i].beginHitsOnTrack_nc(), sizeof(HitOnTrack), tracks[i].nTotalHits(), fp);
447  }
448  }
449 
450  return n_tracks;
451  }
auto const & tracks
cannot be loose
void Event::relabel_bad_seedtracks ( )

Definition at line 778 of file Event.cc.

References seedTracks_, and HLT_FULL_cff::track.

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

778  {
779  int newlabel = 0;
780  for (auto &&track : seedTracks_) {
781  if (track.label() < 0)
782  track.setLabel(--newlabel);
783  }
784  }
TrackVec seedTracks_
Definition: Event.h:61
void Event::relabel_cmsswtracks_from_seeds ( )

Definition at line 786 of file Event.cc.

References cmsswTracks_, iseed, label, and seedTracks_.

786  {
787  std::map<int, int> cmsswLabelMap;
788  for (size_t iseed = 0; iseed < seedTracks_.size(); iseed++) {
789  for (size_t icmssw = 0; icmssw < cmsswTracks_.size(); icmssw++) {
790  if (cmsswTracks_[icmssw].label() == static_cast<int>(iseed)) {
791  cmsswLabelMap[icmssw] = seedTracks_[iseed].label();
792  break;
793  }
794  }
795  }
796  for (size_t icmssw = 0; icmssw < cmsswTracks_.size(); icmssw++) {
797  cmsswTracks_[icmssw].setLabel(cmsswLabelMap[icmssw]);
798  }
799  }
TrackVec cmsswTracks_
Definition: Event.h:62
TrackVec seedTracks_
Definition: Event.h:61
char const * label
int iseed
Definition: AMPTWrapper.h:134
void Event::reset ( int  evtID)

Definition at line 32 of file Event.cc.

References beamSpot_, candidateTracks_, candidateTracksExtra_, cmsswTracks_, cmsswTracksExtra_, evtID(), evtID_, fitTracks_, fitTracksExtra_, cmsLHEtoEOSManager::l, layerHitMasks_, layerHits_, mkfit::Validation::resetValidationMaps(), seedTracks_, seedTracksExtra_, simHitsInfo_, simTracks_, simTracksExtra_, simTrackStates_, and validation_.

Referenced by main().

32  {
33  evtID_ = evtID;
34 
35  for (auto &&l : layerHits_) {
36  l.clear();
37  }
38  for (auto &&l : layerHitMasks_) {
39  l.clear();
40  }
41 
42  simHitsInfo_.clear();
43  simTrackStates_.clear();
44  simTracks_.clear();
45  simTracksExtra_.clear();
46  seedTracks_.clear();
47  seedTracksExtra_.clear();
48  candidateTracks_.clear();
49  candidateTracksExtra_.clear();
50  fitTracks_.clear();
51  fitTracksExtra_.clear();
52  cmsswTracks_.clear();
53  cmsswTracksExtra_.clear();
54  beamSpot_ = {};
55 
56  validation_.resetValidationMaps(); // need to reset maps for every event.
57  }
Validation & validation_
Definition: Event.h:50
virtual void resetValidationMaps()
Definition: Validation.h:50
TrackVec cmsswTracks_
Definition: Event.h:62
int evtID() const
Definition: Event.h:23
TrackExtraVec candidateTracksExtra_
Definition: Event.h:64
TrackVec seedTracks_
Definition: Event.h:61
BeamSpot beamSpot_
Definition: Event.h:56
TrackExtraVec cmsswTracksExtra_
Definition: Event.h:65
TrackExtraVec simTracksExtra_
Definition: Event.h:64
MCHitInfoVec simHitsInfo_
Definition: Event.h:59
std::vector< HitVec > layerHits_
Definition: Event.h:57
TrackVec simTracks_
Definition: Event.h:61
TSVec simTrackStates_
Definition: Event.h:67
int evtID_
Definition: Event.h:53
TrackExtraVec fitTracksExtra_
Definition: Event.h:64
TrackExtraVec seedTracksExtra_
Definition: Event.h:64
TrackVec fitTracks_
Definition: Event.h:61
TrackVec candidateTracks_
Definition: Event.h:61
std::vector< std::vector< uint64_t > > layerHitMasks_
Definition: Event.h:58
void mkfit::Event::resetLayerHitMap ( bool  resetSimHits)
int Event::select_tracks_iter ( unsigned int  n = 0)

Definition at line 718 of file Event.cc.

References mkfit::TrackBase::algorithm(), cmsswTracks_, spr::find(), nt, and seedTracks_.

718  {
719  if (n == 0)
720  return 1;
721 
722  unsigned int algorithms[] = {4, 22, 23, 5, 24, 7, 8, 9, 10, 6}; //to be stored somewhere common
723 
724  //saving seeds by algorithm
725  const int ns = seedTracks_.size();
726 
727  TrackVec cleanSeedTracks;
728  cleanSeedTracks.reserve(ns);
729 
730  for (int ts = 0; ts < ns; ts++) {
731  const Track &tk = seedTracks_[ts];
732  unsigned int algo = (unsigned int)tk.algorithm();
733  if (std::find(algorithms, algorithms + n, algo) != algorithms + n)
734  cleanSeedTracks.emplace_back(seedTracks_[ts]);
735  }
736  seedTracks_.swap(cleanSeedTracks);
737 
738  //saving tracks by algorithm
739  const int nt = cmsswTracks_.size();
740 
741  TrackVec cleanTracks;
742  cleanTracks.reserve(nt);
743 
744  for (int ts = 0; ts < nt; ts++) {
745  const Track &tk = cmsswTracks_[ts];
746  unsigned int algo = (unsigned int)tk.algorithm();
747  if (std::find(algorithms, algorithms + n, algo) != algorithms + n)
748  cleanTracks.emplace_back(cmsswTracks_[ts]);
749  }
750  cmsswTracks_.swap(cleanTracks);
751  return cmsswTracks_.size() + seedTracks_.size();
752  }
TrackVec cmsswTracks_
Definition: Event.h:62
TrackVec seedTracks_
Definition: Event.h:61
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
int nt
Definition: AMPTWrapper.h:42
std::vector< Track > TrackVec
void Event::setInputFromCMSSW ( std::vector< HitVec hits,
TrackVec  seeds 
)

Definition at line 455 of file Event.cc.

References layerHits_, eostools::move(), and seedTracks_.

455  {
456  layerHits_ = std::move(hits);
458  }
TrackVec seedTracks_
Definition: Event.h:61
def move
Definition: eostools.py:511
std::vector< HitVec > layerHits_
Definition: Event.h:57
int Event::use_seeds_from_cmsswtracks ( )

Definition at line 763 of file Event.cc.

References cmsswTracks_, and seedTracks_.

763  {
764  int ns = seedTracks_.size();
765 
766  TrackVec cleanSeedTracks;
767  cleanSeedTracks.reserve(ns);
768 
769  for (auto &&cmsswtrack : cmsswTracks_) {
770  cleanSeedTracks.emplace_back(seedTracks_[cmsswtrack.label()]);
771  }
772 
773  seedTracks_.swap(cleanSeedTracks);
774 
775  return seedTracks_.size();
776  }
TrackVec cmsswTracks_
Definition: Event.h:62
TrackVec seedTracks_
Definition: Event.h:61
std::vector< Track > TrackVec
void Event::validate ( )

Definition at line 59 of file Event.cc.

References mkfit::Config::cmssw_val, mkfit::Validation::fillCMSSWEfficiencyTree(), mkfit::Validation::fillCMSSWFakeRateTree(), mkfit::Validation::fillEfficiencyTree(), mkfit::Validation::fillFakeRateTree(), mkfit::Validation::fillFitTree(), mkfit::Config::fit_val, mkfit::Validation::makeCMSSWTkToRecoTksMaps(), mkfit::Validation::makeCMSSWTkToSeedTkMap(), mkfit::Validation::makeRecoTkToRecoTkMaps(), mkfit::Validation::makeRecoTkToSeedTkMapsDumbCMSSW(), mkfit::Validation::makeSeedTkToRecoTkMaps(), mkfit::Validation::makeSimTkToRecoTksMaps(), mkfit::Validation::setTrackExtras(), mkfit::Validation::setTrackScoresDumbCMSSW(), mkfit::Config::sim_val, mkfit::Config::sim_val_for_cmssw, and validation_.

Referenced by mkfit::runFittingTestPlex().

59  {
60  // special map needed for sim_val_for_cmssw + set the track scores
64  }
65 
66  // standard eff/fr/dr validation
73  }
74 
75  // special cmssw to mkfit validation
76  if (Config::cmssw_val) {
83  }
84 
85  if (Config::fit_val) { // fit val for z-phi tuning
86  validation_.fillFitTree(*this);
87  }
88  }
Validation & validation_
Definition: Event.h:50
virtual void fillEfficiencyTree(const Event &)
Definition: Validation.h:66
virtual void setTrackScoresDumbCMSSW(Event &)
Definition: Validation.h:64
virtual void makeSimTkToRecoTksMaps(Event &)
Definition: Validation.h:56
virtual void setTrackExtras(Event &ev)
Definition: Validation.h:55
virtual void fillCMSSWFakeRateTree(const Event &)
Definition: Validation.h:70
virtual void makeCMSSWTkToRecoTksMaps(Event &)
Definition: Validation.h:59
virtual void makeSeedTkToRecoTkMaps(Event &)
Definition: Validation.h:57
virtual void makeRecoTkToSeedTkMapsDumbCMSSW(Event &)
Definition: Validation.h:62
virtual void makeCMSSWTkToSeedTkMap(Event &)
Definition: Validation.h:61
virtual void makeRecoTkToRecoTkMaps(Event &)
Definition: Validation.h:58
virtual void fillFakeRateTree(const Event &)
Definition: Validation.h:67
virtual void fillCMSSWEfficiencyTree(const Event &)
Definition: Validation.h:69
virtual void fillFitTree(const Event &)
Definition: Validation.h:71
void Event::write_out ( DataFile data_file)

Definition at line 117 of file Event.cc.

References cms::cuda::assert(), align::BeamSpot, beamSpot_, cmsswTracks_, mkfit::DataFile::f_fp, personalPlayback::fp, mkfit::DataFile::hasBeamSpot(), mkfit::DataFile::hasCmsswTracks(), mkfit::DataFile::hasHitIterMasks(), mkfit::DataFile::hasSeeds(), mkfit::DataFile::hasSimTrackStates(), layerHitMasks_, layerHits_, mutex, cms::cuda::nh, seedTracks_, simHitsInfo_, simTracks_, simTrackStates_, findQualityFiles::size, command_line::start, and write_tracks().

Referenced by main().

117  {
118  FILE *fp = data_file.f_fp;
119 
120  static std::mutex writemutex;
121  std::lock_guard<std::mutex> writelock(writemutex);
122 
123  auto start = ftell(fp);
124  int evsize = sizeof(int);
125  fwrite(&evsize, sizeof(int), 1, fp); // this will be overwritten at the end
126 
127  evsize += write_tracks(fp, simTracks_);
128 
129  if (data_file.hasSimTrackStates()) {
130  int nts = simTrackStates_.size();
131  fwrite(&nts, sizeof(int), 1, fp);
132  fwrite(&simTrackStates_[0], sizeof(TrackState), nts, fp);
133  evsize += sizeof(int) + nts * sizeof(TrackState);
134  }
135 
136  int nl = layerHits_.size();
137  fwrite(&nl, sizeof(int), 1, fp);
138  evsize += sizeof(int);
139  for (int il = 0; il < nl; ++il) {
140  int nh = layerHits_[il].size();
141  fwrite(&nh, sizeof(int), 1, fp);
142  fwrite(&layerHits_[il][0], sizeof(Hit), nh, fp);
143  evsize += sizeof(int) + nh * sizeof(Hit);
144  }
145 
146  if (data_file.hasHitIterMasks()) {
147  //sizes are the same as in layerHits_
148  for (int il = 0; il < nl; ++il) {
149  int nh = layerHitMasks_[il].size();
150  assert(nh == (int)layerHits_[il].size());
151  fwrite(&layerHitMasks_[il][0], sizeof(uint64_t), nh, fp);
152  evsize += nh * sizeof(uint64_t);
153  }
154  }
155 
156  int nm = simHitsInfo_.size();
157  fwrite(&nm, sizeof(int), 1, fp);
158  fwrite(&simHitsInfo_[0], sizeof(MCHitInfo), nm, fp);
159  evsize += sizeof(int) + nm * sizeof(MCHitInfo);
160 
161  if (data_file.hasSeeds()) {
162  evsize += write_tracks(fp, seedTracks_);
163  }
164 
165  if (data_file.hasCmsswTracks()) {
166  evsize += write_tracks(fp, cmsswTracks_);
167  }
168 
169  if (data_file.hasBeamSpot()) {
170  fwrite(&beamSpot_, sizeof(BeamSpot), 1, fp);
171  evsize += sizeof(BeamSpot);
172  }
173 
174  fseek(fp, start, SEEK_SET);
175  fwrite(&evsize, sizeof(int), 1, fp);
176  fseek(fp, 0, SEEK_END);
177 
178  //layerHitMap_ is recreated afterwards
179 
180  /*
181  printf("write %i tracks\n",nt);
182  for (int it = 0; it<nt; it++) {
183  printf("track with pT=%5.3f\n",simTracks_[it].pT());
184  for (int ih=0; ih<simTracks_[it].nTotalHits(); ++ih) {
185  printf("hit lyr:%2d idx=%i\n", simTracks_[it].getHitLyr(ih), simTracks_[it].getHitIdx(ih));
186  }
187  }
188  printf("write %i layers\n",nl);
189  for (int il = 0; il<nl; il++) {
190  printf("write %i hits in layer %i\n",layerHits_[il].size(),il);
191  for (int ih = 0; ih<layerHits_[il].size(); ih++) {
192  printf("hit with r=%5.3f x=%5.3f y=%5.3f z=%5.3f\n",layerHits_[il][ih].r(),layerHits_[il][ih].x(),layerHits_[il][ih].y(),layerHits_[il][ih].z());
193  }
194  }
195  */
196  }
TrackVec cmsswTracks_
Definition: Event.h:62
static std::mutex mutex
Definition: Proxy.cc:8
TrackVec seedTracks_
Definition: Event.h:61
assert(be >=bs)
BeamSpot beamSpot_
Definition: Event.h:56
uint32_t nh
MCHitInfoVec simHitsInfo_
Definition: Event.h:59
std::vector< HitVec > layerHits_
Definition: Event.h:57
TrackVec simTracks_
Definition: Event.h:61
TSVec simTrackStates_
Definition: Event.h:67
unsigned long long uint64_t
Definition: Time.h:13
int write_tracks(FILE *fp, const TrackVec &tracks)
Definition: Event.cc:405
tuple size
Write out results.
std::vector< std::vector< uint64_t > > layerHitMasks_
Definition: Event.h:58
int Event::write_tracks ( FILE *  fp,
const TrackVec tracks 
)

Definition at line 405 of file Event.cc.

References mps_fire::i, and command_line::start.

Referenced by write_out().

405  {
406  // Returns total number of bytes written.
407 
408  int n_tracks = tracks.size();
409  fwrite(&n_tracks, sizeof(int), 1, fp);
410 
411  auto start = ftell(fp);
412  int data_size = 2 * sizeof(int) + n_tracks * sizeof(Track);
413  fwrite(&data_size, sizeof(int), 1, fp);
414 
415  fwrite(tracks.data(), sizeof(Track), n_tracks, fp);
416 
417  for (int i = 0; i < n_tracks; ++i) {
418  fwrite(tracks[i].beginHitsOnTrack(), sizeof(HitOnTrack), tracks[i].nTotalHits(), fp);
419  data_size += tracks[i].nTotalHits() * sizeof(HitOnTrack);
420  }
421 
422  fseek(fp, start, SEEK_SET);
423  fwrite(&data_size, sizeof(int), 1, fp);
424  fseek(fp, 0, SEEK_END);
425 
426  return data_size;
427  }
auto const & tracks
cannot be loose

Member Data Documentation

BeamSpot mkfit::Event::beamSpot_

Definition at line 56 of file Event.h.

Referenced by mkfit::StdSeq::loadHitsAndBeamSpot(), main(), read_in(), reset(), and write_out().

TrackVec mkfit::Event::candidateTracks_
TrackExtraVec mkfit::Event::candidateTracksExtra_
mutable
TrackVec mkfit::Event::cmsswTracks_
TrackExtraVec mkfit::Event::cmsswTracksExtra_
mutable
int mkfit::Event::evtID_
private

Definition at line 53 of file Event.h.

Referenced by evtID(), and reset().

TrackVec mkfit::Event::fitTracks_
TrackExtraVec mkfit::Event::fitTracksExtra_
mutable
std::vector<std::vector<uint64_t> > mkfit::Event::layerHitMasks_

Definition at line 58 of file Event.h.

Referenced by Event(), fill_hitmask_bool_vectors(), main(), read_in(), reset(), and write_out().

std::vector<HitVec> mkfit::Event::layerHits_
std::mutex Event::printmutex
static
TrackVec mkfit::Event::seedTracks_
TrackExtraVec mkfit::Event::seedTracksExtra_
mutable
MCHitInfoVec mkfit::Event::simHitsInfo_
TrackVec mkfit::Event::simTracks_
TrackExtraVec mkfit::Event::simTracksExtra_
mutable
TSVec mkfit::Event::simTrackStates_
Validation& mkfit::Event::validation_

Definition at line 50 of file Event.h.

Referenced by Event(), reset(), and validate().