CMS 3D CMS Logo

TrackSoAHeterogeneousT.h
Go to the documentation of this file.
1 #ifndef CUDADataFormats_Track_TrackHeterogeneousT_H
2 #define CUDADataFormats_Track_TrackHeterogeneousT_H
3 
4 #include <string>
5 #include <algorithm>
6 
10 
12 
13 namespace pixelTrack {
14  enum class Quality : uint8_t { bad = 0, edup, dup, loose, strict, tight, highPurity, notQuality };
15  constexpr uint32_t qualitySize{uint8_t(Quality::notQuality)};
16  const std::string qualityName[qualitySize]{"bad", "edup", "dup", "loose", "strict", "tight", "highPurity"};
19  return static_cast<Quality>(qp);
20  }
21 } // namespace pixelTrack
22 
23 template <int32_t S>
25 public:
26  static constexpr int32_t stride() { return S; }
27 
29  using hindex_type = uint32_t;
31 
32  // Always check quality is at least loose!
33  // CUDA does not support enums in __lgc ...
34 private:
36 
37 public:
38  constexpr Quality quality(int32_t i) const { return (Quality)(quality_(i)); }
39  constexpr Quality &quality(int32_t i) { return (Quality &)(quality_(i)); }
40  constexpr Quality const *qualityData() const { return (Quality const *)(quality_.data()); }
41  constexpr Quality *qualityData() { return (Quality *)(quality_.data()); }
42 
43  // this is chi2/ndof as not necessarely all hits are used in the fit
45 
47 
48  constexpr int nTracks() const { return nTracks_; }
49  constexpr void setNTracks(int n) { nTracks_ = n; }
50 
51  constexpr int nHits(int i) const { return detIndices.size(i); }
52 
53  constexpr bool isTriplet(int i) const { return nLayers(i) == 3; }
54 
55  constexpr int computeNumberOfLayers(int32_t i) const {
56  // layers are in order and we assume tracks are either forward or backward
57  auto pdet = detIndices.begin(i);
58  int nl = 1;
59  auto ol = phase1PixelTopology::getLayer(*pdet);
60  for (; pdet < detIndices.end(i); ++pdet) {
61  auto il = phase1PixelTopology::getLayer(*pdet);
62  if (il != ol)
63  ++nl;
64  ol = il;
65  }
66  return nl;
67  }
68 
69  // State at the Beam spot
70  // phi,tip,1/pt,cotan(theta),zip
74  constexpr float charge(int32_t i) const { return std::copysign(1.f, stateAtBS.state(i)(2)); }
75  constexpr float phi(int32_t i) const { return stateAtBS.state(i)(0); }
76  constexpr float tip(int32_t i) const { return stateAtBS.state(i)(1); }
77  constexpr float zip(int32_t i) const { return stateAtBS.state(i)(4); }
78 
79  // state at the detector of the outermost hit
80  // representation to be decided...
81  // not yet filled on GPU
82  // TrajectoryStateSoA<S> stateAtOuterDet;
83 
86 
87 private:
88  int nTracks_;
89 };
90 
91 namespace pixelTrack {
92 
93 #ifdef GPU_SMALL_EVENTS
94  // kept for testing and debugging
95  constexpr uint32_t maxNumber() { return 2 * 1024; }
96 #else
97  // tested on MC events with 55-75 pileup events
98  constexpr uint32_t maxNumber() { return 32 * 1024; }
99 #endif
100 
104 
105 } // namespace pixelTrack
106 
107 #endif // CUDADataFormats_Track_TrackHeterogeneousT_H
constexpr int computeNumberOfLayers(int32_t i) const
constexpr bool isTriplet(int i) const
eigenSoA::ScalarSoA< int8_t, S > nLayers
Quality qualityByName(std::string const &name)
const std::string qualityName[qualitySize]
constexpr Quality * qualityData()
static constexpr int32_t stride()
constexpr uint32_t maxNumber()
constexpr float phi(int32_t i) const
eigenSoA::ScalarSoA< uint8_t, S > quality_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
constexpr Quality quality(int32_t i) const
eigenSoA::ScalarSoA< float, S > pt
eigenSoA::ScalarSoA< float, S > chi2
constexpr float tip(int32_t i) const
constexpr uint32_t qualitySize
TrajectoryStateSoAT< S > stateAtBS
constexpr Quality const * qualityData() const
double f[11][100]
constexpr uint8_t getLayer(uint32_t detId)
constexpr float zip(int32_t i) const
constexpr void setNTracks(int n)
cms::cuda::OneToManyAssoc< hindex_type, S+1, 5 *S > HitContainer
constexpr float charge(int32_t i) const
__host__ __device__ constexpr Scalar * data()
Definition: eigenSoA.h:26
constexpr int nHits(int i) const
constexpr Quality & quality(int32_t i)
eigenSoA::ScalarSoA< float, S > eta
constexpr int nTracks() const